Stop the redirection after WooCommerce add to cart

Viewed 8788

I wish to completely remove any redirection after a user click on the ADD TO CART button.

Actually I am not using the products page.
I am using a simple button with the link to the product, like this: ?add-to-cart=492.

My user will click on several "add to cart" buttons on my page, so he cant be redirected to any page after clicking in the first button.

At the end of the page he will find a CHECKOUT button to pay and that is it.

Any ideas how to achieve this?

Thanks

2 Answers

Like in the woocommerce itself does in the product-code shortcode you could just use the filter for the simple-add to cart button 'woocommerce_add_to_cart_form_action'.

// Change form action to avoid redirect.
add_filter( 'woocommerce_add_to_cart_form_action', '__return_empty_string' );
Related