Answer the question
In order to leave comments, you need to log in
How to fix redirect error when deleting product from WooCommerce cart?
There was such a problem when deleting a product from the WooCommerce cart. After clicking on "Delete" it loads for a few seconds, after which the browser gives an error that the site has redirected too many times. What can be done?
Here is the website (product page). Try to add to cart and delete immediately on the next page.
innsleep.by/product/odeyalo
Answer the question
In order to leave comments, you need to log in
The problem was in the code with which I skipped the cart and went straight to checkout. The code redirected the user from the cart to the payment page, in turn, the payment page does not open if the cart is empty (after deleting the product) and redirects to the cart page and so on in a circle.
I found 2 solutions, either delete the redirect code, or cancel the redirect from the payment page if the cart is empty. I did with this code
add_filter( 'woocommerce_checkout_redirect_empty_cart', '__return_false' );
add_filter( 'woocommerce_checkout_update_order_review_expired', '__return_false' );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question