Here we learn about how to update cart on quantity change value.
1. Custom code copied and paste into your child theme’s file and folder.
2. we have to hide the ‘Update cart’ button.
Add below CSS code on file ‘child-theme/style.css’.
.woocommerce button[name="update_cart"], .woocommerce input[name="update_cart"] { display: none; }
3. Enqueue js file ‘child-theme/functions.php’.
<?php function myblog_enqueue_styles() { wp_enqueue_script( 'ajax-script', get_stylesheet_directory_uri().'/js/custom.js' , array( 'jquery' ) ); } add_action( 'wp_enqueue_scripts', 'myblog_enqueue_styles' ); ?>
4. Add below JS code on file ‘child-theme/js/custom.js’.
<script> jQuery(function(){ jQuery( '.woocommerce' ).on( 'change', 'input.qty', function(){ jQuery( '[ name="update_cart" ]' ).trigger( 'click' ); }); }); </script>
OUTPUT:
In this article, we have to show Create and Used PIPE in angular
In this article, we have to show Create and Used PIPE in angular
In this article, we have to show Create and Used PIPE in angular
View Comments
hello sir,
the code does not work well for me, I have to click twice at quantity increment button. If I click one time, its does do anything.