Woocommerce redirection to checkout for certain after product added to cart

I have implement this code in function.php to redirect the page to checkout if product with id(26285) added to the cart .This is the code

add_action( 'woocommerce_add_to_cart', 'custom_add_to_cart', 1, 2 ); function custom_add_to_cart( $  cart_item_key, $  product_id ) {  $  site_url = get_site_url(); if($  product_id == 26285) {  // Redirecting to some url wp_redirect($  site_url.'/my-account/'); exit; }} 

the condition i need to satisfy here is , if the product with ID:26285 added to the cart i need to redirect to checkout.The problem i am facing now is the page is redirecting but the product was not adding to cart . How to achive that?

Your help will very much appreciated. Have a nice day!

woocommerce adding specific out of stock product directly to checkout [closed]

i have two types of products in my store , one is in stock products and the other one is on request product. On request product is set as out of stock . If a user needs an on request product he will will give a request , then from backend we will approve the request then in the oser account page we will give an proceed to checkout button which is an direct checkout . The issue is if i added the product to checkout page like this( Domainname/checkout/?add-to-cart=product id ) iam getting an error message like this(You cannot add “product 1” to the cart because the product is out of stock).

for checking the validation i have used the woocommerce_add_to_cart_validation hook but its only working if any of product is there in cart .

Woocommerce shipping options not changing checkout total

I am working with woocommerce at the moment, I have created a child theme off of storefront, and I notice that when I change the shipping option to once that has a price the total order price does not change, and Javascript error is thrown. I have not changed any of the parent theme for this process so I am not sure why it would be throwing an error?

The error is as follows,

enter image description here

If I just use storefront it works fine, so there must be a conflict in my child theme but I am not sure where to start?

Is it legal to post card data from an ecommerce checkout to a PCI compliant ‘store’

Let’s say I want to charge a user’s credit card with their permission after a sale takes place. But, I don’t want to have to ask them their credit card a second time.

Is it legal to store the credit card information as they’re filling it out on the checkout, for say 6 hours or something, on a PCI compliant data store, and then only if they perform the action which lets them know their card will be billed again, then and only then charge it.

And then just delete records of cards after some number of time?

Set default value in billing_ field checkout woocommerce

espero alguien me pueda ayudar porque esto me va a volver loco. El problema es le siguiente. Tengo un input select justo debajo de order_comments, dentro del checkout. Necesito tomar ese valor de ese select, realizar una busqueda en mi base de datos y con los resultados, rellenar los campos billing. se entiende?

enter image description here

la variable $ select, la obtengo de un codigo ajax que recoje previamente el valor del campo select, despues de aqui. ese codigo no hace nada, y no se como pasar el valor del input al checkbox.

Alquien que me de una ayuda con eso, le estaré agradecido.

Reload part of checkout on changed shipping method

So I added the following action to add extra content about ‘local pickup’ to the checkout page.

add_action( 'woocommerce_review_order_before_payment', 'my_custom_action', 20 ); 

When I change the shipping method I want to ‘reload’ the action to hide/show the content in case the shipping method is local pickup.

I’m not an expert on hooks or wordpress ajax… can’t figure this thing out

When choosing payment options during checkout, should the Paypal option go directly to Paypal, or show a “continue to Paypal” link?

I currently have 2 payment options during checkout: Credit Card and Paypal. Currently, clicking on the Credit Card option will reveal a credit card form, and clicking on the Paypal option will take the user to Paypal checkout (on the Paypal site).

I have also seen it where sites such as Netflix, will show a “continue to paypal” link after selecting the Paypal payment method, instead of going straight to Paypal (shown below)

Payment Options

Paypal option selected

Is the “continue to paypal” link helpful to the user, or does it just add an extra step/confusion (because the user isn’t taken straight to Paypal after selecting the Paypal option)?

How is it possible that Google Analytics is showing a high bounce rate (50%) on a cart and checkout page?

The cart and checkout pages are not landing pages so it isn’t possible for that to be the first page in their session. The exit rate is way too low (approximately 15%) which signals to me that the bounces should be counted as exits. Also, it isn’t reasonable to believe they would time out often enough that Google Analytics counts it as a bounce.

Possible thoughts is that it’s an issue with nonInteraction?

This is an ongoing issue I have been trying to correct for the business, any help would be great.