Last active
December 29, 2022 10:44
-
-
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
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
.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