How to Add WPCodeBox to Your WordPress...
Move WPCodeBox menu to the top bar for easy access in WordPress.

WPCodeBox
490
This WooCommerce code snippet automatically updates cart quantities, eliminating the need to click “Update Cart” and streamlining the shopping experience for your customers.
<?php
add_action('wp_head', function(){
$css_code = <<<CSS
<style>
.woocommerce-notices-wrapper div.woocommerce-message[role=alert] {
display: none;
}
.woocommerce button[name="update_cart"] {
display: none !important;
}
</style>
CSS;
$js_code = <<<JS
<script type="text/javascript">
jQuery(document).ready(function(){
var wpcbScrollToNotices;
jQuery(document).ajaxComplete(function (e) {
jQuery.scroll_to_notices = wpcbScrollToNotices;
});
jQuery('.woocommerce').on('change', 'input.qty', function(){
wpcbScrollToNotices = jQuery.scroll_to_notices;
jQuery.scroll_to_notices = function( scrollElement ) {
return false;
};
setTimeout(function(){
jQuery('button[name="update_cart"]').trigger('click');
}, 200);
});
});
</script>
JS;
echo $css_code;
echo $js_code;
});
Move WPCodeBox menu to the top bar for easy access in WordPress.





