Auto-update Cart on Quantity Change
This snippet automatically updates the cart when the quantity of an item is changed, without requiring a manual update.
PHP
function auto_update_cart_on_quantity_change() {
?>
<script type="text/javascript">
jQuery(function($){
$('form.woocommerce-cart-form').on('change', 'input.qty', function(){
$("[name='update_cart']").trigger("click");
});
});
</script>
<?php
}
add_action( 'wp_footer', 'auto_update_cart_on_quantity_change' );
Snippet Feedback
Did this snippet work for you? Do you have any questions about this snippet? Leave some feedback below.
SHARED BY
15 Views