Why Do WooCommerce Cart Fragments Slow Down My Site?
Why WooCommerce Loads Cart Fragments
WooCommerce needs the mini-cart to reflect the customer's current cart contents accurately even on pages that were served from cache, since a cached page can't know what's actually in a specific visitor's cart — Cart Fragments solves this by running a small AJAX request after page load to fetch and inject the correct current cart data, but this default behavior runs broadly rather than being scoped only to where it's genuinely needed.
When This Becomes a Real Problem
- A high-traffic store generates a correspondingly high volume of these AJAX requests, adding real cumulative server load even though each individual request is small.
- Pages that don't actually display a mini-cart (a blog post, a static content page) still triggering the fragments request unnecessarily if it isn't scoped down.
- Combined with other performance issues, the additional request can be the difference between a genuinely fast page and a merely acceptable one.
- Disabling it entirely isn't always safe, since some cart-related functionality depends on it — this needs a considered approach rather than simply switching it off everywhere.
Addressing Cart Fragments Overhead
- Limit Cart Fragments to only pages that actually display a mini-cart, rather than site-wide, using a targeted code adjustment or a plugin built for this.
- Test the mini-cart and cart-related functionality thoroughly after any change, since disabling this incorrectly can break cart display.
- Combine with broader caching and performance improvements rather than treating this as a standalone fix.
Measure before you change anything
- Find the request. In the browser's Network tab, filter for
wc-ajax=get_refreshed_fragments. Note how often it fires, how long it takes, and whether it fires on pages with no mini-cart at all. - Read the response time. This request can't be served from page cache, so a slow response under traffic points to the cost of running PHP and every plugin hooked into the cart.
- Check what depends on it. Many themes use fragments to update a header cart count. Switching the script off without checking that breaks the count.
A safe order of changes
- First, scope it. Only load the
wc-cart-fragmentsscript on pages that actually show a mini-cart. - Then test adding to cart, removing items and the header count on both desktop and mobile.
- If the live-updating mini-cart isn't earning its place, a plain link to the cart page is cheaper and avoids the request altogether.
Need Cart Fragments and broader checkout performance optimized properly? See WordPress speed optimization.