How to update cart from shop page when product quantity increase/decrease in woocommerce?
Question
Here is the code I am using for updating my cart with ajax in CART page-
jQuery('div.woocommerce').on('change keyup mouseup', 'input.qty', function(){ // keyup and mouseup for Firefox support
if (timeout != undefined) clearTimeout(timeout); //cancel previously scheduled event
if (jQuery(this).val() == '') return; //qty empty, instead of removing item from cart, do nothing
timeout = setTimeout(function() {
jQuery('[name="update_cart"]').trigger('click');
}, 1000 );
});
Its working fine , but my problem is when I try with same code in shop page its not updating my cart –
Here is what i have tried –
jQuery('li.product').on('change keyup mouseup', 'input.qty', function(){ // keyup and mouseup for Firefox support
if (timeout != undefined) clearTimeout(timeout); //cancel previously scheduled event
if (jQuery(this).val() == '') return; //qty empty, instead of removing item from cart, do nothing
timeout = setTimeout(function() {
jQuery('[name="update_cart"]').trigger('click');
}, 1000 );
});
Here is the link if u want to check(https://cdn.royalancer.co.uk/test/).
0
customization, php, plugin-development, theme-development, woocommerce
4 years
2019-11-04T12:06:32-05:00
2019-11-04T12:06:32-05:00 0 Answers
76 views
0
Leave an answer