WooCommerce · 30 November 2026

Page caching a WooCommerce shop: baskets, stock and prices

A shop's product pages are the same for most visitors and worth caching. The basket, the stock level and the price are not always the same, and each breaks a page cache in its own way. Here are the three journeys to test, and what to do about each.

By Shane Rounce · 5 minute read

The problem: fast pages, wrong shop

A shop is harder to cache than a blog because it changes without anyone editing it. Somebody buys the last one. A sale starts at midnight. A new visitor adds an item and expects it to still be there on the next page.

When a cached shop goes wrong, it rarely looks like a cache fault. It looks like an empty basket, an item that says "in stock" and cannot be bought, or yesterday's price. I have found it easiest to think of three journeys and test each one on purpose.

What must never be cached

Start with the fixed rules. These stay live for every visitor:

  • The basket, checkout and account pages, at whatever addresses your shop uses for them.
  • Any request that adds to, removes from or updates the basket.
  • Any request carrying a basket or shop session cookie.
  • The Store API routes for the basket and checkout.

Ace Redis Cache applies these without being asked, and reads your shop's configured page addresses instead of trusting the default English ones. A shop that has renamed "cart" to "basket" is exactly the shop that a list of default names misses. The WooCommerce wiki page lists every guard.

Journey one: the first add to basket

A new visitor arrives with no cookies. That is what makes their product page cacheable. Then they press "add to basket", and during that one request the shop has to create a session and send its cookie.

If a cache guard looks only at the cookies that came in, it sees an anonymous visitor and may treat the whole request as anonymous, stripping the new session cookie on the way out. The item is accepted and immediately forgotten. The next page shows an empty basket.

You will not see this as a developer, because you already have a session. That is why it survives so long.

Test it clean:

  1. Open a private window. No sign-in, no cookies.
  2. Go straight to a product page. Check it is a cache hit.
  3. Add the product to the basket.
  4. Open the basket page. The item should be there.
  5. Refresh, change the quantity, then go back to a product page and return to the basket.
  6. Repeat with each kind of add button your shop has: a simple product form, a variable product, and any add button that works without a page load.

The other half is not starting sessions too early. If the shop sets its basket cookie on every product view, every visitor stops being cacheable on their first page. ARC can stop that cookie being set on product, shop and category pages, so guests stay cacheable until they add something.

Journey two: stock changes that nobody edited

A purchase, a refund, a stock import and a scheduled sale all change what a product page should say. None of them is an editor pressing Update, so a cache that only listens for post saves misses all four.

List the routes that change stock or price on your shop, and check each one reaches the cache:

What happenedDoes your cache hear about it?
Product edited in wp-adminUsually yes
Order placed, stock reducedOften not
Order refunded or cancelled, stock restoredOften not
Stock updated by an import or an APIOften not
A scheduled sale starts or endsOften not

Three things to get right:

  • Use the shop's own events. WooCommerce announces stock and product changes. Listen for those instead of guessing from database writes.
  • Follow a variation back to its parent. A variation has its own stock record, but shoppers see it on the parent product's page. That is the page to refresh.
  • Stay narrow. Refresh the affected product page, not the whole site. A busy shop that empties its cache on every order never has a warm cache.

Then be honest about what a narrow refresh does not cover. A category grid, a filter count and an "in stock" listing elsewhere may still show the old state. Each is a separate dependency. In ARC, product and variation changes refresh the product's page, the block cache tracks which products each cached grid depends on, and a product built from other products is refreshed when one of its components changes.

Test it with a real transition:

  1. Load a product page signed out until it is a cache hit.
  2. Change its stock through the shop's normal workflow, not by editing the database.
  3. Load the page again signed out. It should show the new stock, and the header should show a rebuild, not a wait for expiry.
  4. Check an unrelated product is still a hit. If it is not, the refresh was too wide.

Journey three: prices that depend on who is asking

A product ID does not describe a price. The price a visitor sees can depend on currency, tax display, their country, a membership or a trade account.

Before caching anything that shows a price, list the inputs that can change it. Then choose:

  • The same for everyone. One currency, one tax display, no customer pricing. Cache freely.
  • A small number of variants. Two currencies, say. Put the variant in the cache key and store each one.
  • Different per customer. Do not use the shared copy for that request. A correct slow answer beats a fast wrong price.

ARC treats shop blocks as unsafe to share between roles when it detects customer-specific pricing or tax based on address, and leaves them live.

Whatever is displayed, the server must still work out the real price when the item is added and when the order is placed. Cached display data is never the authority for what to charge.

Warm the pages that matter after a clear

An empty cache on a shop means slow first views of the pages that earn money. After a clear, ARC warms the home page, the shop page, the busiest categories and the most popular products in the background, 20 products by default.

Checklist

  • Basket, checkout and account stay live, at your shop's real addresses.
  • The first add to basket works in a clean private window, by every route.
  • Guests are not given a session before they need one.
  • Orders, refunds, imports and scheduled sales all refresh the product page.
  • A variation refreshes its parent.
  • Anything showing a price varies by every input that changes the price, or is not shared.
  • The server checks the price again at the basket and at the order.

For the general rule behind all of this, read cache the page, not the visitor. To see what the cache did with a request, use the response headers. The features page lists the WooCommerce handling in full.

All notes Get the latest release