Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Cart quantity update not recalculating total: how to fix it

CNV-156Medium impactCould addBy FunnelGuardPublished Updated
On this page

What this issue is

A shopper changes a quantity in the cart, from 1 to 3 for example. The number in the box changes, but the subtotal, shipping or order total stays the same. Or the total updates on screen but reverts when they reach checkout.

Most carts update through AJAX, which means the page sends a small background request to the server and redraws part of the page with the reply. If that request fails, is cached, or the page ignores the reply, the total is never redrawn.

Why it costs you leads or sales

Shoppers do not know which number to trust. If the total looks wrong they may stop, suspect a pricing error, or leave to compare elsewhere. If the screen total is lower than the real one, they get a surprise at checkout. If it is higher, they may never buy the extra items.

Where the cart total breaks
  1. Add to cartItem added correctly
  2. Change quantityShopper sets 1 to 3
  3. Recalculate totalRequest fails or reply ignored
  4. CheckoutShopper doubts the price and leaves
  5. PurchaseSale lost

The quantity change is sent, but the total never refreshes, so the later steps are lost.

Carts that continue to checkoutExample numbers
Carts that continue to checkout (example)Total updates: 60 %; Total stuck: 35 %023466035Total updatesTotal stuck%

Example: illustrative numbers only. Carts where the total updates correctly versus carts where it does not.

How to check if your site has it

Test the quantity update by hand
  1. Use a clean browser

    Open a private window with no extensions so cached data and ad blockers do not hide the cause.

  2. Add a product and note the total

    Write down the line price, subtotal, shipping and order total.

  3. Change the quantity

    Use the plus button, the number box and the Update cart button if your theme has one. Test each way.

  4. Compare the numbers

    The total should equal price x quantity plus shipping and tax. Check that the cart count in the header also changes.

  5. Reload the page

    If the total reverts after reload, the screen updated but the server did not save the change.

  6. Open DevTools

    In Chrome press F12, open the Network tab and change the quantity. Look for the request (on Shopify /cart/change.js or /cart/update.js, on WooCommerce admin-ajax.php or a wc-ajax call). Note its status code and the Console tab for red errors.

What the network request tells you
What you seeLikely cause
No request sentJavaScript error or a button covered by another element
Request returns 4xx or 5xxServer error, security token expired, or a firewall rule
Request returns 200 but total is oldCached response or theme ignores the reply
Total right after request, wrong after reloadChange not saved to the session or cart cookie

How to fix it

The fix depends on which row of the table you matched. Start with the generic steps, then use your platform's tab.

General fix order
  1. Fix JavaScript errors first

    Any red error in the Console on the cart page can stop the update script. Disable recently added apps or plugins one at a time to find the one that conflicts.

  2. Exclude the cart from caching

    Cart, checkout and account pages and cart AJAX calls must never be served from a page or CDN cache.

  3. Make sure the theme redraws the total

    After the quantity request succeeds, the theme must re-render the cart totals from the reply.

  4. Check stock and limits

    If the requested quantity exceeds stock or a maximum, the platform may reject it silently. Show a clear message instead.

Fix by platform
  1. Test with a default theme

    On a staging copy, switch to a default theme such as Twenty Twenty-Four. If the total updates, your theme's cart template or script is the cause.

  2. Deactivate plugins one by one

    In Plugins, deactivate optimisation, popup and cart add-on plugins first, retesting after each.

  3. Exclude cart from cache

    In your caching plugin's settings, exclude the Cart and Checkout pages and the cookies woocommerce_cart_hash and woocommerce_items_in_cart. Also exclude JavaScript from delay or minify options if the cart script breaks.

  4. Check the cart page template

    In WooCommerce, make sure the Update cart button is not removed by theme overrides. Overridden templates in your theme's woocommerce folder can be out of date; compare them with the plugin's version.

Example: update quantity and redraw the total (Shopify cart API)javascript
async function setQuantity(lineKey, quantity) {
  const res = await fetch('/cart/change.js', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ id: lineKey, quantity: quantity })
  });
  if (!res.ok) {
    console.error('Quantity update failed', res.status);
    return;
  }
  const cart = await res.json();
  document.querySelector('[data-cart-total]').textContent =
    (cart.total_price / 100).toFixed(2);
  document.querySelector('[data-cart-count]').textContent = cart.item_count;
}

How to confirm it's fixed

Confirmation checks
  • Changing quantity with plus, minus and typing all update the line total.
  • Subtotal, shipping and order total change together.
  • The header cart count matches the new quantity.
  • The total is still correct after a page reload.
  • The same total appears at checkout.
  • No red errors in the Console and the cart request returns 200.
  • Tested on mobile and desktop, logged in and logged out.
Cart behaviour

Broken

  • Quantity changes to 3, total still shows one item
  • No message when the request fails
  • Total differs at checkout

Fixed

  • Total redraws within a moment of the change
  • Errors show a clear message
  • Cart and checkout totals match

How to prevent it happening again

Prevention habits
  • Run the quantity test after every theme update, app install or cache setting change.
  • Test changes on a staging copy or duplicate theme first.
  • Keep cart and checkout excluded from every cache layer, including the CDN.
  • Keep a short written test script so anyone on the team can repeat it.
  • Review Console errors on the cart page after each release.

How FunnelGuard handles this

FunnelGuard does not check this yet. Asserting the cart total after a quantity change is a possible future check, not a current feature.

What FunnelGuard does today is run your real customer journeys on a schedule, such as a checkout or lead form, from the EU or the US, and check each step. If a journey stops working because a page error or a covered button blocks the path, a failure is re-checked from a second region and you get one alert with a screenshot and a likely cause. That can surface a broken cart page, but it does not compare totals after a quantity change.

To watch for this issue today, add the manual test above to your release checklist and run it weekly. You can also use any browser automation tool you already have to change a quantity and assert the displayed total. A free FunnelGuard plan (1 site, 2 journeys, daily checks, no card) can cover the wider path to checkout while you do that.

Questions people ask

Why is my cart total not updating when I change the quantity?

Usually the quantity request fails or the page ignores the reply. Common causes are a JavaScript error from a plugin or app, a cached cart response, or a theme that doesn't redraw the totals. Open DevTools, change the quantity and check the Network and Console tabs to see which one it is.

Why does the cart total change back after I refresh the page?

The screen updated but the server never saved the new quantity. This often happens when the request fails silently, the cart cookie or session is not stored, or a cache serves an old cart. Check the request status and make sure cart pages are excluded from caching.

How do I fix the Update cart button not working in WooCommerce?

Deactivate plugins one at a time, especially caching, optimisation and cart add-ons, and test with a default theme. Exclude the Cart and Checkout pages from caching, and compare any overridden templates in your theme's woocommerce folder with the current plugin versions.

Can caching stop the cart total from updating?

Yes. If a page cache or CDN serves a stored version of the cart or its AJAX responses, shoppers see old totals. Exclude cart, checkout and account pages and cart endpoints from every cache layer, or send a no-store cache header.

How do I test that a cart quantity change recalculates the total?

Add a product in a private browser window, change the quantity using each control, and check the line total, subtotal, shipping and order total. Reload the page and go to checkout to confirm the numbers still match.

Does FunnelGuard check cart quantity updates?

No, not yet. Asserting the total after a quantity change is a possible future check. FunnelGuard currently runs your journeys such as checkouts and lead forms on a schedule and checks each step, so use a manual test for quantity changes.

Is a wrong cart total a conversion problem or a trust problem?

Both. Shoppers who see a total that does not match their quantity may think the price is wrong and leave, even if checkout would have been correct. Fixing it removes a doubt right before payment.

Does FunnelGuard catch this?

Could add

Not checked yet: could be added to FunnelGuard.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.