这是我用来在CART页面中用ajax更新购物车的代码-
jQuery('div.woocommerce').on('change keyup mouseup','input.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');
},1000 );
});
它工作正常,但是我的问题是,当我在商店页面中尝试相同的代码时,它没有更新我的购物车- 这是我尝试过的-
jQuery('li.product').on('change keyup mouseup',1000 );
});
如果您要检查(https://cdn.royalancer.co.uk/test/),这是链接。