var timeout; jQuery('div.woocommerce').on('change keyup mouseup', 'input.qty, select.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'); }, acauPhpVars.acau_update_delay ); // schedule update cart event with delay in miliseconds specified in plugin settings });