Checkout & cart page – remove item issue
-
Hi,
I have a problem with checkout & cart page when removing the last item in the cart.
If I remove the item on a cart page – I succesfully get re-directed to the empty cart page. If I try to remove the item on the checkout page – I get 20 re-directs to the checkout page and eventually a timeout because cart is empty and there is nothing to check out. Both URL’s on a red X icon are the same as below – although cart page has a different slug.https://white-bg.com/porachka-2?remove_item=f127a3f714240273e254d740ed23f001&_wpnonce=1bcd186273
Cart: https://white-bg.com/%d0%ba%d0%be%d0%bb%d0%b8%d1%87%d0%ba%d0%b0
Checkout: https://white-bg.com/porachka-2Any help would be appreciated. At the moment I have resolved it with the following snippet:
add_action( ‘template_redirect’, ’empty_cart_redirection’ );
function empty_cart_redirection(){
if( WC()->cart->is_empty() && is_cart() ){
wp_safe_redirect( esc_url( home_url( ‘/’ ) ) );
exit;
}
}The problem with snippet is that when customer checks out – he will get re-directed to the home page instead of a thank you page.
The topic ‘Checkout & cart page – remove item issue’ is closed to new replies.