skip to Main Content

Auto-update cart when quantity changed in WooCommerce

add_action( 'wp_footer', 'cart_update_qty_script' );
function cart_update_qty_script() {
if (is_cart()) :
?>
<script>
jQuery('div.woocommerce').on('change', '.qty', function(){
jQuery("[name='update_cart']").removeAttr('disabled');
jQuery("[name='update_cart']").trigger("click"); 
});
</script>
<?php
endif;
}

Read More: https://gist.github.com/lukecav/e96f03693958bd0758a52e3a25ee48d8

Back To Top