Skip to content

Instantly share code, notes, and snippets.

@mohsinworld
Last active December 29, 2022 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohsinworld/260436bac39b8cc40a0570fe3ec26f5a to your computer and use it in GitHub Desktop.
Save mohsinworld/260436bac39b8cc40a0570fe3ec26f5a to your computer and use it in GitHub Desktop.
Add this code the functions.php file (CSS to hide update button) Source: https://rudrastyh.com/woocommerce/remove-update-cart-button.html
.woocommerce button[name="update_cart"],
.woocommerce input[name="update_cart"] {
display: none!important;
}
====================================================================
add_action( 'wp_footer', function() {
?><script>
jQuery( function( $ ) {
let timeout;
$('.woocommerce').on('change', 'input.qty', function(){
if ( timeout !== undefined ) {
clearTimeout( timeout );
}
timeout = setTimeout(function() {
$("[name='update_cart']").trigger("click"); // trigger cart update
}, 500 ); // 1000 for one second delay, half a second (500) seems comfortable too
});
} );
</script><?php
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment