add_action('wp_footer', 'wbmz_auto_update_cart');
function wbmz_auto_update_cart(){
?>
<script>
var timeout;

jQuery( function( $ ) {
	$('.woocommerce').on('change', 'input.qty', function(){

		if ( timeout !== undefined ) {
			clearTimeout( timeout );
		}

		timeout = setTimeout(function() {
			$("[name='update_cart']").trigger("click");
		}, 1000 ); // 1 second delay, half a second (500) seems comfortable too

	});
} );
</script>
<style>
.woocommerce button[name="update_cart"],
.woocommerce input[name="update_cart"] {
	display: none;
}
</style>
<?php
};

Geef een reactie 0