Site logo

Archived topic

Automatic product update

2 replies · Started by Jacob on February 23, 2022

Viewing posts 1–3 of 3

Hi All.

Automatically update the quantity of products in the shopping cart
No need to click a button [Update Shopping Cart]
To use this you need the plugin [Code Snippets]
code-snippets

add_action( 'wp_footer', 'cart_update_qty_script' );
function cart_update_qty_script() {
  if (is_cart()) :
   ?>
    <script>
        jQuery('div.woocommerce').on('change', '.qty', function(){
           jQuery("[name='update_cart']").removeAttr('disabled');
           jQuery("[name='update_cart']").trigger("click"); 
        });
   </script>
<?php
endif;
}

Hope I helped

Hi there,

thanks for sharing this. I think some users may find it handy :)

I was happy to share. You can stick it in GeneratePress documentation. I was glad to help

This archived topic is closed to new replies.