Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stoffl6781/d571b6524c960ab1e5e663c3ace7187a to your computer and use it in GitHub Desktop.
Save stoffl6781/d571b6524c960ab1e5e663c3ace7187a to your computer and use it in GitHub Desktop.
jQuery(function ($) {
let timeout;
const registerUpdateCartEvent = () => {
$(".woocommerce-cart-form").on("change", "input.qty", function () {
if (timeout !== undefined) {
clearTimeout(timeout);
}
timeout = setTimeout(function () {
$("[name='update_cart']").trigger("click");
}, 750);
});
}
$( document.body ).on( 'updated_cart_totals', function(){
registerUpdateCartEvent();
});
registerUpdateCartEvent();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment