Skip to content

Instantly share code, notes, and snippets.

@imran-khan1
Last active July 11, 2019 18:11
Show Gist options
  • Save imran-khan1/250203ab1965f40c6962d4893b6fe8e2 to your computer and use it in GitHub Desktop.
Save imran-khan1/250203ab1965f40c6962d4893b6fe8e2 to your computer and use it in GitHub Desktop.
<?php
/*
update cart on quantity field value change
*/
add_action( 'wp_footer', 'wc_qty_change_update_cart' );
function wc_qty_change_update_cart() {
if (is_cart()) :
?>
<script>
jQuery('body').on('click', 'div.woocommerce .qty', function(){
jQuery("[name='update_cart']").trigger("click");
});
</script>
<?php
endif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment