Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save FrancoStino/f6afe86c6ccc35c3c707f6adc891f830 to your computer and use it in GitHub Desktop.
Save FrancoStino/f6afe86c6ccc35c3c707f6adc891f830 to your computer and use it in GitHub Desktop.
Automatically Update Cart on Quantity Change - WooCommerce
<?
/**
* Automatically Update Cart on Quantity Change - WooCommerce
*/
add_action( 'wp_footer', 'bbloomer_cart_refresh_update_qty' );
function bbloomer_cart_refresh_update_qty() {
if ( is_cart() || ( is_cart() && is_checkout() ) ) { ?>
<script>
jQuery('div.woocommerce').on('change', 'input.qty', function(){
jQuery("[name='update_cart']").removeAttr('disabled').attr('aria-disabled','false').trigger("click");
});
</script>
<style>
input[name='update_cart'] {
display: none !important;
}
/* OR TRY THIS */
button[name='update_cart'] {
display: none !important;
}
</style><?
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment