L
L
ligisayan2017-05-05 17:32:45
PHP
ligisayan, 2017-05-05 17:32:45

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

2 answer(s)
L
ligisayan, 2017-05-06
@ligisayan

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.
});

V
Viktor Yanyshev, 2017-05-05
@villiwalla

If in the array (object) of goods <= 0 then the redirect

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question