What it does
The wc-cart-fragments script asks the server for the current cart HTML and stores it in the browser’s session storage, so cached pages can still show the right cart count. Since WooCommerce 7.8 core loads it only where the classic Cart widget needs it, but many themes and plugins still load it on every page.
| Request | Cached by page cache? | Cost |
|---|---|---|
| Product or category page | Yes | Low |
?wc-ajax=get_refreshed_fragments | No, by design | Full WordPress load per visitor |
?wc-ajax=update_order_review (checkout) | No | Expected; checkout only |
Why it matters for checkout
Under load, those uncached requests compete with checkout for the same PHP workers. During a sale, a fragments request on every page view can use up the workers, and checkout requests start queuing or timing out. The store looks slow everywhere, and checkout is where it costs money.
# How many fragment requests per hour, and how long they take (nginx with $request_time)
grep "get_refreshed_fragments" /var/log/nginx/access.log | wc -l
awk '/get_refreshed_fragments/ {s+=$NF; n++} END {if (n) print n, "requests, avg", s/n, "s"}' /var/log/nginx/access.log$request_time.Handling it
- Measure first. Count the requests and their time; on a small store it may not matter.
- Load it only where needed. If the header cart is a block or does not need live updates, the script can be removed on pages where it is not used.
- Never cache it. A cached fragments response shows one shopper’s cart to others; exclude
wc-ajaxfrom every cache. - Test add to cart after. Removing the script can leave the mini cart stale; check add to cart, the mini cart and checkout as a new visitor.
Plugins that switch off cart fragments are common. After enabling one, the header cart may show 0 items after add to cart, and shoppers think the add failed.
Confirm the store still sells
Any change here touches add to cart. Run a full purchase as a new visitor after it. Related: hosting limits under load and Cloudflare and CDN caching.
Check your own store now with the free WooCommerce checkout checker: it walks the checkout in a real browser, stops before payment, and shows the step where it breaks.
Find out your checkout broke before your customers do.
Real checkout checks for Magento and WooCommerce · free plan · no card requiredWooCommerce checkout monitoring →