On this page
What this issue is
WooCommerce keeps a small piece of cart HTML, called a fragment, so the header cart icon and count can update without reloading the page. To do this, the script wc-cart-fragments.js sends an AJAX request (a background request to your server) to /?wc-ajax=get_refreshed_fragments. Older setups use admin-ajax.php instead.
Why it costs you leads or sales
Slow pages lose visitors before they reach a product or checkout. On shared hosting or a busy store, a burst of fragment requests can push up server response time (TTFB, the time before the first byte arrives) for everyone, including shoppers who are about to pay. It can also make the cart icon flicker or show a stale count.
- Visitor opens a pageServed quickly from cache
- Cart fragments script loadsRuns on every page
- get_refreshed_fragments callHits PHP and database, uncached
- Server queue growsTTFB rises under traffic
- Visitor leaves or hesitatesFewer carts and checkouts
The cached page is fast, but the fragment request bypasses the cache.
Example: illustrative response times on a busy shared host, not measured data.
How to check if your site has it
Open DevTools
In Chrome, press F12 and go to the Network tab. Tick Disable cache and reload a page in a private window.
Filter for the request
Type
get_refreshed_fragmentsorwc-ajaxin the filter box. If you see a request, the script is active.Read its timing
Click the request and open Timing. A Waiting (TTFB) value of several hundred milliseconds or more on an empty cart is a sign of waste.
Check the script
Search the page source for
wc-cart-fragmentsto see whether the script is enqueued.Check your host
Look at the access logs or your host's monitoring for many
wc-ajax=get_refreshed_fragmentshits compared with page views.
How to fix it
Decide first whether your theme needs a live mini cart. If the cart icon shows a count or a dropdown, you need fragments on those pages. If it is just a link to the cart page, you can remove the script. Always test on a staging copy, then check add to cart and checkout.
Use a performance plugin option
Plugins such as Perfmatters or Disable Cart Fragments offer a toggle to disable cart fragments. Many let you disable it everywhere except the cart and checkout. Check your plugin's settings for the exact name.
Or add code to a child theme
Use the snippet below in your child theme's functions.php or a code snippets plugin. Back up first.
Dequeue the script
Add the PHP snippet below to your theme or a small plugin. Adjust the conditions if your header mini cart must stay live on some pages.
Clear caches
Purge page cache, CDN and minified assets so the script is no longer served.
Not the place for this fix
GTM cannot stop WooCommerce enqueuing the script. Make the change in WordPress, then check in GTM Preview that your cart-related tags still fire.
add_action( 'wp_enqueue_scripts', function () {
if ( function_exists( 'is_cart' ) && ( is_cart() || is_checkout() || is_account_page() ) ) {
return;
}
wp_dequeue_script( 'wc-cart-fragments' );
}, 11 );How to confirm it's fixed
- The get_refreshed_fragments request no longer appears on product and content pages
- TTFB on key pages is the same or lower than before
- Adding a product still updates the cart page and checkout totals
- The header cart count is correct where it is shown
- Checkout completes a test order in test mode
- Purchase and add to cart tracking events still fire
How to prevent it happening again
Themes and plugin updates can re-enqueue the script. Keep your dequeue code in a child theme or a small plugin so it survives updates. Re-check the Network tab after major theme, WooCommerce or caching changes, and keep an eye on TTFB over time.
How FunnelGuard handles this
FunnelGuard detects this issue only partly. A robot visitor loads your pages on a schedule and checks TTFB and page weight. A rise in either can be a symptom of heavy cart fragment traffic, so you get an alert with a screenshot and a likely cause.
What it does not do: it does not confirm that wc-cart-fragments.js or the get_refreshed_fragments request is the cause, and it does not inspect your server logs or plugin settings. To cover the rest by hand, use the Network tab check above, review host logs, and test the header cart after each theme or plugin update. The Free plan (1 site, 2 journeys, daily checks, no card) lets you start watching your add to cart journey.
Questions people ask
What are WooCommerce cart fragments?
Cart fragments are small pieces of cart HTML that WooCommerce refreshes through an AJAX request so the mini cart stays current. The script wc-cart-fragments.js calls ?wc-ajax=get_refreshed_fragments on page load. It is useful for a live header cart but costly on busy sites.
Why is my WooCommerce site slow with wc-ajax=get_refreshed_fragments?
That request is dynamic, so page caches and CDNs usually cannot serve it. Each page view can run PHP and database queries, which raises TTFB under traffic. Slow hosting makes the effect worse.
How do I disable cart fragments in WooCommerce?
Dequeue the wc-cart-fragments script with wp_dequeue_script in a child theme, or use a performance plugin that has a disable option. Keep it on the cart and checkout pages if your theme needs it there. Test add to cart afterwards.
Is it safe to disable cart fragments?
It is safe if your theme does not show a live cart count or dropdown. If it does, the count may stay stale after adding a product. Test on staging and keep the script on pages that need it.
Does disabling cart fragments break checkout?
Normally no, because the cart and checkout pages render their own totals. Problems appear only if a theme relies on fragments for the mini cart. Run a test order after the change.
How can I see if cart fragments is slowing my pages?
Open DevTools, go to Network, disable cache and filter for get_refreshed_fragments. Check the Waiting time on an empty cart. Compare TTFB on pages with the script removed.
Can FunnelGuard detect cart fragments problems?
Only partly. It checks TTFB and page weight on scheduled runs and alerts you if they worsen, but it does not identify the cart fragments request itself as the cause. You confirm that by hand.
Related issues
- OPS-252WooCommerce update breaks checkout blocksFix guide
- OPS-254Woo checkout fields removed by pluginFix guide
- OPS-256Stock management showing all out of stockFix guide
- OPS-255Order emails disabled in Woo settingsFix guide
- OPS-258Tax settings wrong (VAT not applied)Fix guide
- OPS-253Payment plugin outdated / API version deprecatedFix guide