Archived topic
how to update cart automatically in WooCommerce cart page
3 replies · Started by xinghui on October 7, 2022
how to update cart automatically in WooCommerce cart page when change product quantity.I added some code to make my product price change when the product quantity on my cart page changes, I added this code to my wp-footer hook but found it is not correct, please help I'll check why, thanks
This is the code I am adding:
jQuery( function( $ ) {
$('.woocommerce').on('change', 'input.qty', function(){
$("[name='update_cart']").trigger("click");
});
} );
Here is the link to the screenshot of the image displayed on my website after I added the code:https://i.postimg.cc/hjgVYrP0/cart-update.jpg
Hi there,
remove the CSS you're using to hide the Update Cart Button, then retry.
Thank you David, after I deleted the CSS code, I re-added the update code, it showed the effect, I put the hidden update cart code in wp-footer and it also took effect, thank you very much
Glad to be of help!