Answer the question
In order to leave comments, you need to log in
How to redirect to a template with an empty cart when deleting the last item?
Hello! There is an online store on wordpress + woocommerce.
I have different templates for shopping cart and empty cart. Such a question: how to make it so that when the last product is deleted, a redirect to a template with an empty basket is performed, and not just the line "your basket is empty" appears in the basket, and in the total field the amount changes only now for some reason when the basket is updated, and not immediately (we get such an unpleasant moment when there are actually no goods in the cart and it writes empty, and the amount is not updated with ajax). How to do it?
Answer the question
In order to leave comments, you need to log in
Found a solution - attached to the updated_wc_div trigger
$('body').on('updated_wc_div',function() {
location.reload(); // uncomment this line to refresh the page.
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question