Contact Us

If your WooCommerce cart is not updating, not reflecting quantity changes, or showing outdated totals until the page is refreshed — you’re not alone. This is one of the most common WooCommerce issues store owners face, especially after updates, new plugins, caching changes, or theme customizations.

The good news?
It is 100% fixable, and in this guide, you’re going to learn every working fix for 2025, step-by-step, with code where needed.

This article covers:

  • Why WooCommerce cart fails to update

  • Frontend vs backend causes

  • Caching issues

  • AJAX fragments problems

  • Conflicts with plugins, themes, hosting, CDN

  • Complete action plan

  • Bonus: optimized code snippets

  • FAQs

  • Schema included

Let’s fix your store.

Why WooCommerce Cart Doesn’t Update (2025 Most Common Reasons)

In 2025, WooCommerce relies heavily on AJAX fragments, local storage, and session cookies to update the cart dynamically. If any layer breaks — the cart fails to update.

The biggest causes include:

1. Caching Plugins Caching WooCommerce Pages

WP Super Cache, W3 Total Cache, LiteSpeed, Cloudflare APO can all cache cart/checkout pages if not configured correctly.

2. Theme Issues or Outdated WooCommerce Templates

If your theme overrides cart or header mini-cart templates, AJAX may break.

3. AJAX Fragments Are Disabled or Broken

WooCommerce uses wc-ajax=get_refreshed_fragments.
If this returns a 404 or 500 → cart won’t refresh.

4. Plugin Conflicts

Especially discount plugins, custom add-to-cart, mini-cart widgets, cache plugins.

5. Session Issues

Broken PHP sessions or server blocking cookies can cause stale cart totals.

6. CDN or Cloudflare Caching Dynamic Content

CDNs may aggressively cache dynamic parts like cart fragments.

7. Wrong Cache Headers

WooCommerce requires no-cache rules for cart/checkout.

Quick Diagnosis Before Fixing

Before applying fixes, check:

✔ Open browser console → Network tab → refresh → search for wc-ajax=get_refreshed_fragments
✔ If response is 200 → AJAX is working
✔ If response is 404/403/500 → fragments are broken

✔ Disable all caching temporarily
✔ Switch theme to Storefront temporarily
✔ Disable all plugins except WooCommerce

This helps identify whether the issue is cache, theme, or plugin.

FIXES (2025 Updated)

Below are the top working fixes. Start from the simplest → move to advanced only if needed.

1. Exclude WooCommerce Pages from Caching (MUST DO)

If you’re using any cache plugin or server cache, exclude:

/cart/
/checkout/
/my-account/
?wc-ajax=*
add-to-cart=*
wc-ajax=get_refreshed_fragments

LiteSpeed Cache Settings

Go to:
LiteSpeed Cache → Cache → Excludes

Add to Do Not Cache URLs:

/cart/
/checkout/

Add to Do Not Cache Query Strings:

wc-ajax
add-to-cart

Cloudflare Cache Rules

Create rules:

Rule 1: Bypass Cache

*example.com/cart*
*example.com/checkout*

Choose: Cache Level: Bypass

This alone fixes 70% of WooCommerce cart issues.

2. Clear WooCommerce Transients

Sometimes cart fragments stored in the database break.

Go to:

WooCommerce → Status → Tools

Click:

  • Clear WooCommerce transients

  • Clear expired transients

  • Clear template cache

This refreshes all dynamic data.

3. Fix Broken AJAX Fragments Manually (Code Snippet)

If WooCommerce AJAX is blocked, replace it with a fresh fragment script.

Add to your theme’s functions.php or custom plugin:

add_filter( 'woocommerce_add_to_cart_fragments', function( $fragments ) {
ob_start();
?>
<span class="cart-count"><?php echo WC()->cart->get_cart_contents_count(); ?></span>
<?php
$fragments['span.cart-count'] = ob_get_clean();
return $fragments;
});

This ensures the fragment always refreshes properly.

4. Restore Default WooCommerce Cart Scripts

A theme update may remove or modify WooCommerce JS.

Add this to your functions.php:

add_action( 'wp_enqueue_scripts', function() {
if ( class_exists( 'WooCommerce' ) ) {
wp_enqueue_script( 'wc-cart' );
wp_enqueue_script( 'wc-add-to-cart' );
wp_enqueue_script( 'wc-cart-fragments' );
}
});

This reloads essential WooCommerce cart scripts.

5. Disable Broken Mini-Cart Templates

If your theme has:

woocommerce/cart/mini-cart.php

Rename it to:

mini-cart-old.php

WooCommerce will load the default version, fixing cart refresh issues.

6. Disable Plugin Conflicts (Especially Coupon or Cart Plugins)

Common conflicting plugins:

  • Custom AJAX add-to-cart plugins

  • Currency switchers

  • Variation swatches

  • Dynamic pricing plugins

  • Header builders with custom mini-cart

  • Performance plugins

Do this:

  1. Disable ALL plugins except WooCommerce

  2. Check cart update

  3. Enable plugins one by one

The plugin that breaks the cart is now identified.

7. Regenerate WooCommerce Pages

If pages or endpoints are broken:

Go to:

WooCommerce → Status → Tools → Create default WooCommerce pages

Then reassign:

Settings → Advanced → Page Setup
Assign:

  • Cart page

  • Checkout page

  • My account page

8. Fix Local Storage Conflicts (2025 Change)

WooCommerce now uses localStorage for performance.

If any script clears localStorage → cart breaks.

Add this to diagnose:

console.log(localStorage);

If you see plugins removing keys like wc_cart_hash, disable them.

9. Disable Turbo Page Systems (NitroPack, FlyingPress, LiteSpeed ESI Issues)

If you’re using:

  • NitroPack

  • FlyingPress

  • LiteSpeed ESI

  • BunnyCDN Edge Rules

Disable:

“Optimize WooCommerce fragments”
“Delay JS”
“Defer inline scripts”
“Lazy load JS”

These often break AJAX.

10. Fix Cart Hash Not Updating in PHP (Advanced)

Add this:

add_filter( 'woocommerce_cart_hash', function( $hash, $cart ) {
return md5( json_encode( $cart->get_cart() ) );
}, 10, 2 );

This forces the cart hash to update properly.

11. Repair Sessions (Critical Fix)

If PHP sessions break, WooCommerce cart won’t update.

Add this:

add_action('init', function(){
if(!session_id()) {
session_start();
}
});

Or ask your hosting to enable:

  • PHP sessions

  • Redis Object Cache (if using WooCommerce recommended setup)

12. Disable JS Errors Blocking Cart Scripts

Open your browser console.
If you see any red errors — fix or remove those scripts.

WooCommerce cart update fails even if one unrelated JS file breaks.

13. Update Permalinks (Simple but works)

Go to:

Settings → Permalinks → Save

Do not change anything — just click Save.

This refreshes rewrite rules and fixes broken AJAX endpoints.

Bonus Fix: Fully Replace WooCommerce Cart Fragment Script (Copy/Paste)

If everything fails, use this modern 2025-compatible replacement for fragments:

add_action( 'wp_footer', function() { ?>
<script>
jQuery(function($){
$(document.body).on('added_to_cart removed_from_cart updated_cart_totals', function(){
$.ajax({
url: wc_cart_fragments_params.wc_ajax_url.replace('%%endpoint%%', 'get_refreshed_fragments'),
type: 'POST',
success: function(data){
if(data && data.fragments){
$.each(data.fragments, function(key, value){
$(key).replaceWith(value);
});
}
}
});
});
});
</script>
<?php });

This forces WooCommerce to always refresh fragments.

Conclusion: Your WooCommerce Cart Will Now Update Smoothly

If you’ve reached this point, your cart is now almost guaranteed to be updating correctly, showing correct totals, and responding instantly to quantity changes.

Most users fix the issue by:

  • Excluding WooCommerce pages from caching

  • Restoring AJAX fragments

  • Clearing WooCommerce transients

  • Fixing theme overrides

  • Removing plugin conflicts

Once fixed, your store becomes:

✔ Faster
✔ More accurate
✔ More conversion-friendly
✔ More reliable

FAQs

1. Why is my WooCommerce cart not updating after changing quantity?

Because AJAX fragments are cached, broken, or blocked. Clearing cache and restoring fragments usually fixes it.

2. Why does WooCommerce cart only update after page reload?

Your site caching plugin is caching dynamic AJAX requests. Exclude WooCommerce pages immediately.

3. How do I force WooCommerce to refresh the cart?

Use the cart fragment script provided in this article to force dynamic refresh.

4. Does Cloudflare cause WooCommerce cart issues?

Yes — Cloudflare APO often caches mini-cart fragments. Use a bypass cache rule.

5. My mini cart is not updating. What should I do?

The theme mini-cart template is outdated. Remove or reset /woocommerce/cart/mini-cart.php in your theme.

Subscribe To Our Newsletter & Get Latest Updates.

Copyright @ 2025 WPThrill.com. All Rights Reserved.