S
S
semenyuk732020-08-20 22:24:57
WordPress
semenyuk73, 2020-08-20 22:24:57

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

2 answer(s)
S
semenyuk73, 2020-08-20
@semenyuk73

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' );

A
Anton R., 2020-08-20
@anton_reut

Your url innsleep.by/product/odeyalo accepts a POST request, see what happens after that and why there is an endless redirect.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question