Want to speed up your WooCommerce store without making checkout harder for shoppers? Cart fragments keep mini-cart totals and item counts updated as customers browse, but the extra background requests may not be necessary for every store. If your theme or setup doesn’t rely on live cart updates, disabling this feature could help reduce unnecessary activity.
In this guide, you’ll learn how to disable WooCommerce cart fragments when they’re not needed, what to check before making the change, and how to confirm your cart still works as expected. With a few careful steps, you can simplify your store’s performance and keep the shopping experience smooth.
Understand What Cart Fragments Do—and When They Slow Your Store Down
A mini cart that changes instantly can feel seamless, but that convenience may come with background work your store doesn’t need. Before deciding whether to remove it, it helps to see what’s being refreshed and whether shoppers actually rely on those live updates.
How WooCommerce cart fragments update the mini cart
When a shopper adds an item to the cart, WooCommerce can send an AJAX request to retrieve updated cart information without reloading the page. The response—known as a cart fragment—can replace parts of the page, such as the mini-cart contents, item count, or subtotal.
This keeps cart displays in sync as customers browse, but it also means extra requests and scripts may run. Depending on your WooCommerce version, theme, and plugins, fragments may be loaded on pages where a live mini cart is visible or used. The feature is most useful when customers expect cart details to change immediately.
That live behavior isn’t essential for every shopping journey. The next step is to look for signs that the background updates add activity without providing a noticeable benefit.
Signs your store may not need cart fragments
Your store may be a candidate for disabling fragments if its cart display stays static between page loads or if customers rarely use a mini cart. For example, a shop that sends shoppers directly to a dedicated cart page may not need an always-updating header count.
Consider whether you notice unnecessary AJAX activity or performance concerns on pages that don’t use cart information. These clues don’t prove fragments are the cause, but they can help guide a focused test. Look for patterns such as:
- A mini cart that isn’t displayed or is rarely used.
- Cart details that update only after a page refresh.
- Extra cart-related requests on pages where live cart updates aren’t needed.
Even if those signs apply, a theme or extension may depend on the feature behind the scenes. A quick compatibility check can prevent a small speed change from becoming a confusing cart problem.
Check your theme, plugins, and cart experience before changing anything
First, review your theme’s header and shopping flow: does the cart count or mini cart promise to update as soon as an item is added? Then check plugins that customize cart buttons, side carts, or product bundles. These tools may use fragment updates to show the latest items.
Before you use a method to WooCommerce disable cart fragments, record how the cart behaves now and test on a staging site if possible. Add and remove products, navigate between pages, and confirm the cart page and checkout show accurate totals. If any live cart feature stops updating, restore the setting or code and investigate which component relies on fragments.
WooCommerce Disable Cart Fragments: Safe Ways to Turn Them Off
Once you’ve confirmed that live mini-cart updates aren’t essential, the next step is choosing a reversible way to switch them off. A targeted change is usually safer than removing scripts without checking where your theme or extensions rely on them.
If you’re comfortable adding a small amount of PHP, you can dequeue the fragments script on selected pages. This approach lets you keep it active on the cart and checkout while removing it elsewhere.
Disable cart fragments with a code snippet
Add the snippet below to your child theme’s functions.php file or a code-snippet manager. The priority gives WooCommerce a chance to enqueue its scripts first.
addaction( 'wpenqueuescripts', function() {
if ( ! iscart() && ! ischeckout() ) {
wpdequeuescript( 'wc-cart-fragments' );
}
}, 99 );This WooCommerce disable cart fragments example leaves the script available on cart and checkout pages, but mini-cart counts may no longer update immediately on other pages. The <a href="https://developer.wordpress.org/reference/functions/wpdequeuescript/”>WordPress function reference explains how dequeuing a script works. Test the result with your theme and extensions; some setups may enqueue the script differently.
If editing theme files feels risky, a dashboard tool can make the change easier to manage and undo. Choose one that lets you control where and when a snippet runs.
Use a performance plugin or code-snippet manager
Some performance plugins offer script-management controls, while snippet managers let you add the same PHP without editing theme files. Use a plugin you trust, and check whether its settings target the wc-cart-fragments handle rather than disabling unrelated WooCommerce scripts.
Keep a note of the setting or snippet you changed. If the mini cart stops behaving as expected, you’ll be able to switch it off quickly and restore the previous behavior.
Whichever method you choose, consider which parts of the shopping journey display cart information. A faster page is only helpful if shoppers can still see accurate cart details.
Avoid breaking the cart, checkout, or mini cart
After disabling the script, check whether your header count, side cart, or add-to-cart notices depend on live fragments. If they do, either keep fragments enabled or use a more selective setup that preserves the feature where it matters.
- Confirm the cart page shows the right products, quantities, and totals.
- Check that checkout completes and reflects cart changes.
- Test any drawer, popup, or header mini cart after adding an item.
Before making the change on your live store, try it in an isolated copy. That gives you room to catch theme or plugin conflicts without interrupting shoppers.
Test the change on a staging site first
On staging, record the current behavior, apply the change, then test product pages, navigation, cart updates, and checkout on desktop and mobile. Also review browser console errors and cart-related network requests; fewer requests alone don’t prove the shopping flow is working correctly.
If everything checks out, deploy during a quieter period and repeat the key tests on the live site. Keep your rollback option ready: if cart displays become stale or checkout behaves differently, restore the snippet or plugin setting while you investigate.
WooCommerce Disable Cart Fragments: Test the Results and Choose the Right Setup
With the change in place, the useful question is not simply whether a request disappeared—it’s whether the store feels faster while cart details remain dependable. A quick before-and-after check can help you decide whether to keep the change, narrow it to certain pages, or restore live updates.
Start with evidence you can compare rather than relying on a single speed score. The checks below help distinguish a measurable improvement from a change that affects the shopping experience.
Measure page speed and server requests before and after
Run the same key pages through a performance tool before and after the change, ideally under similar conditions. Compare load time and the number of cart-related network requests, but treat small score differences cautiously: caching, traffic, and test location can all affect results.
In your browser’s developer tools, open the Network panel and look for requests related to cart fragments, including getrefreshed_fragments. Check product, shop, and other relevant pages. If requests decrease but visitors see no meaningful speed improvement, the trade-off may not be worthwhile.
Numbers tell only part of the story; the cart itself needs a real-world check. Follow a shopper’s path from browsing to placing an order, paying attention to when cart information changes.
Check cart updates across product, shop, and checkout pages
Add a product from a product page, then navigate to the shop or another category. Confirm whether the header count or mini cart updates as expected, and test quantity changes and removals on the cart page.
Complete a test order using your store’s available test mode, if possible. Verify that the checkout reflects the correct items and totals. Include mobile navigation and any side-cart or popup features in your checks, since these may behave differently from a desktop header.
If the main cart works but a small display does not, the issue may be limited to the mini cart rather than checkout. A few targeted checks can help identify what needs to be restored.
Troubleshoot a stale mini cart or missing cart count
First, clear page and object caches, then test in a private browser window. Cached markup can make a cart count appear stale even when the cart session is current. If the problem persists, temporarily restore fragments and retest to see whether a theme or extension depends on them.
- Check theme settings for a live cart-count option.
- Review side-cart and add-to-cart plugins for fragment dependencies.
- Look for JavaScript errors that could prevent the display from updating.
Once you know which pages need live updates, choose the narrowest configuration that supports them. That keeps the performance change aligned with how customers actually shop.
Decide whether to disable fragments sitewide or only on selected pages
A store without a live mini cart may be able to disable fragments more broadly. If the header count or drawer updates while shoppers browse, keep the script active on the pages where that behavior matters.
For many stores, a selective setup is the safer starting point. Test it against your theme and extensions rather than assuming every installation uses fragments in the same way.
And if testing reveals that shoppers rely on immediate cart feedback, restoring the feature is a sensible outcome—not a failed optimization. Keep the rollback simple so you can respond quickly.
Re-enable cart fragments if your store needs live cart updates
Remove or disable the snippet or plugin rule you added, then clear caches and repeat the cart checks. Confirm that the mini cart, counts, and add-to-cart flow update again across the pages where customers expect them.
The right WooCommerce disable cart fragments setup is the one that improves performance without making cart status confusing. If live updates are essential, leave fragments enabled and look for other performance changes that don’t affect that experience.
Keep Cart Updates Only Where They Help Your Shoppers
Disabling WooCommerce cart fragments can reduce unnecessary background activity, but it’s not a one-size-fits-all speed fix. The best setup depends on whether your theme and plugins rely on live mini-cart updates—and whether shoppers benefit from seeing cart changes instantly.
Make a targeted, reversible change, then compare performance and test the full shopping journey. If cart details stay accurate and the improvement is meaningful, keep the change. If the mini cart becomes confusing or unreliable, restore fragments or limit the change to pages that don’t need them.
A faster store should still feel effortless to shop. Let real testing guide your WooCommerce disable cart fragments setup, and you’ll find the right balance between performance and a smooth customer experience.