Automatically Update the WooCommerce Cart on Quantity Change

Today we have a quick Snippet for you that will allow you to have your cart totals update automatically as you change the quantity field without having to click the update button on the cart page.

Simply add these to Divi > Theme Options > Integrations tab, under the Body section.

WooCommerce Cart Page

If you are NOT using our custom quantity feature from Divi BodyCommerce, use the code below.

WooCommerce Cart Page with BodyCommerce custom quantity

If you are using WooCommerce with BodyCommerce you can do so much more. If you are using our custom quantity feature (form field customiser), use the code below.


  1. Thanks, works like a charm! I found this looking for a similar function for the single product page, using the Divi Woo Modules. Is there a similar code for that?


    • That is a different ball game. Not so easy, sorry. If using BodyCommerce and our mini cart option – you can make this happen this way

      • Hi, how to use it on the mini cart?

        • Sorry this code is just for the cart page

  2. Thank you so much, worked! 🙂

    • Pleasure, glad to help 😀

  3. cool it work perfect, I added a delay, the cart update will wait a while for the customer to click multiple times

    var timeout;

    jQuery(document).ready(function ($) { // On jQeury load
    $(document).on(“click”, ‘.sub, .add’, function () { // When changing the custom “+” or “-”

    if ( timeout !== undefined ) {
    clearTimeout( timeout );

    timeout = setTimeout(function() {

    }, 5000 ); // 1 second delay, half a second (500) seems comfortable too// Update the cart

    • Nice one – appreciate it!

    • Thanks … exactly the script I needed!

  4. work perfect…great tutorial

Submit a Comment

Explore more from Divi Engine