Last active
January 28, 2022 14:27
-
-
Save FrancoStino/f6afe86c6ccc35c3c707f6adc891f830 to your computer and use it in GitHub Desktop.
Automatically Update Cart on Quantity Change - WooCommerce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/** | |
* 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