All posts

Cart fragments and a slow WooCommerce store

Open the Network tab on many WooCommerce stores and you will see `?wc-ajax=get_refreshed_fragments` on every page. It keeps the mini cart in the header correct. It also bypasses the page cache and loads WordPress fully, every time, for every visitor.

Free checkout scan

Enter your store address. A real browser adds a product to the cart and walks the checkout up to the payment step, like a customer, and shows you every step with a screenshot.

  • Free, no account
  • Stops before payment, no order
  • Nothing to install
· Updated · 2 min read
An hourglass on a table

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.

RequestCached by page cache?Cost
Product or category pageYesLow
?wc-ajax=get_refreshed_fragmentsNo, by designFull WordPress load per visitor
?wc-ajax=update_order_review (checkout)NoExpected; 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.

bash
# 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
The average only works if your log format ends with $request_time.

Handling it

  1. Measure first. Count the requests and their time; on a small store it may not matter.
  2. 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.
  3. Never cache it. A cached fragments response shows one shopper’s cart to others; exclude wc-ajax from every cache.
  4. 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.
Removing it can break the cart display

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 →
FAQ

Common questions

Still have a question?More answers, and a way to reach us.Support →
01What is get_refreshed_fragments in WooCommerce?

An AJAX request from the wc-cart-fragments script that fetches the current mini cart HTML. It bypasses the page cache by design.

02Should I disable WooCommerce cart fragments?

Only after measuring, and only where the mini cart does not need live updates. Test add to cart and the mini cart afterwards.

03Can cart fragments be cached?

No. A cached response would show one shopper’s cart to others. Exclude wc-ajax requests from every cache layer.