Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Cached page showing another visitor's cart or data: how to fix it

OPS-108High impactCould addBy FunnelGuardPublished Updated
On this page

What this issue is

A cache keeps a copy of a page so it can be served fast without asking your server each time. That is fine for a blog post, because everyone sees the same thing. It goes wrong when the page is personalised: it shows a cart, a logged-in name, an address, an order confirmation or a pre-filled form.

If the cache stores that page and hands it to the next visitor, the next visitor sees the first person's data. Common causes are a CDN rule such as Cloudflare's 'Cache Everything' applied to all URLs, a host or plugin cache that ignores cart and session cookies, and a server that sends a Set-Cookie header on a page that was then cached.

Why it costs you leads or sales

Visitors who see a stranger's name or items in their basket lose trust straight away. Many leave, and some report you. Others get a cart full of products they did not choose, or a checkout that charges or ships the wrong thing.

The opposite also happens: a cached empty cart shows to someone who added products, so they think the add-to-cart button failed and give up. Beyond lost sales, you carry legal and reputational risk.

How one visitor's data reaches another
  1. Visitor A loads cartPage includes A's items and name
  2. Cache stores pageNo rule says 'private'
  3. Visitor B requests cartCache answers without asking server
  4. B sees A's dataTrust lost, possible breach

The cache stores a personalised response and serves it to everyone after.

How to check if your site has it

Test as two different visitors who share nothing. Use a normal browser window and a private window on a different device or network if you can.

Two-visitor test
  1. Add an item as visitor A

    In a normal window, add a product to the cart and open the cart and checkout pages. Note what shows.

  2. Open the same URLs as visitor B

    In a private window (no cookies), open the same cart and checkout URLs. You should see an empty cart and no personal data.

  3. Read the response headers

    Open DevTools, Network tab, click the page request and look at Response Headers. Check cache-control, set-cookie, cf-cache-status (Cloudflare), x-cache or age.

  4. Look for HIT status

    A cf-cache-status: HIT or an age above 0 on a cart, account or thank-you page means a shared cache served it. That page should not be cached.

  5. Check logged-in pages too

    Repeat for account, order confirmation and any page with a pre-filled form or a name in the header.

Check headers from the command linebash
curl -sI https://example.com/cart/ | grep -iE 'cache-control|set-cookie|cf-cache-status|x-cache|age|vary'
What the headers tell you on a private page
HeaderSafe on cart/checkoutWarning sign
cache-controlprivate, no-storepublic, max-age=...
cf-cache-statusDYNAMIC or BYPASSHIT
ageabsent or 0a number above 0
set-cookiepresent only on uncached responsespresent on a HIT response

How to fix it

The principle is the same everywhere: private pages must bypass every shared cache, and the server must say so in its headers. Apply it at each layer you use (CDN, host, plugin).

Stop caching private pages by platform
  1. Exclude cart, checkout and account

    In your caching plugin (WP Rocket, W3 Total Cache, LiteSpeed Cache and similar), add /cart/, /checkout/ and /my-account/ to the never-cache list. Most plugins do this for WooCommerce automatically, so check it has not been turned off.

  2. Exclude by cookie

    Add the cookies woocommerce_cart_hash, woocommerce_items_in_cart and wordpress_logged_in_ to the cache-bypass cookie list.

  3. Check the host cache

    Managed hosts often run their own page cache. Look in the host dashboard for cache exclusions and add the same URLs.

Example: mark private pages as uncacheable (nginx)nginx
location ~ ^/(cart|checkout|my-account) {
    add_header Cache-Control "private, no-store" always;
    proxy_pass http://app;
}
After changing the rules
  1. Purge the cache

    Purge everything at each layer: CDN, host and plugin. Old cached copies keep leaking until they are removed.

  2. Rotate anything sensitive

    If cached pages exposed tokens, order links or session identifiers, invalidate them where your platform allows.

  3. Record what happened

    Note the time window, affected URLs and a likely number of people. You may need this for a privacy assessment.

Cart page before and after the fix

Before

  • cache-control: public, max-age=3600
  • cf-cache-status: HIT on /cart/
  • Visitor B sees visitor A's items

After

  • cache-control: private, no-store
  • cf-cache-status: DYNAMIC or BYPASS
  • Each visitor sees only their own cart

How to confirm it's fixed

Confirmation checks
  • Cart, checkout, account and thank-you pages return private, no-store or an equivalent.
  • Those pages show DYNAMIC, BYPASS or MISS, never HIT.
  • A private window with no cookies sees an empty cart and no names.
  • Two devices on different networks see different carts when each adds a different product.
  • The cache was purged at CDN, host and plugin level.
  • Public pages such as the home page and blog are still cached, so speed is not lost.

How to prevent it happening again

Prevention
  • Never use 'Cache Everything' without bypass rules for private paths and session cookies.
  • Add the two-visitor test to your release checklist after any CDN, plugin or theme change.
  • Keep a written list of URLs that must never be cached and review it when you add pages such as a new checkout step or portal.
  • Load personal data with a request made after the page loads, tied to the user's session, rather than building it into cached HTML.
  • Review caching rules whenever you switch host, add a CDN or install a performance plugin.
Example: how a leak can unfold
  1. Day 1

    A performance plugin update turns on full-page caching for all URLs.

  2. Day 1, later

    A customer views their cart and the page is stored.

  3. Day 2

    Other visitors start seeing that cart. A few emails arrive.

  4. Day 3

    You add bypass rules and purge all caches.

  5. Day 3

    Two-visitor test passes.

How FunnelGuard handles this

FunnelGuard does not check for this yet. Spotting one visitor's data on another visitor's page is a possible future check, but it is not something the service does today.

What FunnelGuard does do is run your real journeys, such as lead forms and checkouts, on a schedule from the EU or the US, and check each step. If a bad cache rule breaks the add-to-cart step, a form or a tracking hit, a failed run is re-checked from a second region and you get one alert with a screenshot and a likely cause. That can reveal a caching problem indirectly, but it will not tell you that private data is being shared.

To watch for this yourself, repeat the two-visitor test after each deploy or cache change, and keep an eye on the cf-cache-status and cache-control headers of your cart and account URLs. A free FunnelGuard plan (1 site, 2 journeys, daily checks, no card) can cover the basic journey while you do that.

Frequently asked questions

Questions people ask

Why is my website showing another customer's cart?

A cache is almost certainly storing the cart page after one visitor loads it and then serving that copy to others. This happens when a CDN rule such as 'Cache Everything' or a caching plugin does not bypass cart pages or session cookies. Exclude cart, checkout and account URLs from caching and purge the cache.

How do I stop Cloudflare caching my cart and checkout pages?

Create a Cache Rule that matches paths like /cart, /checkout and /account, or requests carrying your session cookie, and set it to 'Bypass cache'. Place it above any rule that caches everything. Then purge the cache and test with a private window.

Is showing another user's data from cache a data breach?

It can be. If personal data such as names, addresses or order details was shown to people who should not see it, privacy rules like GDPR may apply and may require an assessment or notification. Fix the cache, record the time window and affected pages, and consult whoever handles privacy for your business.

How can I tell if a page was served from cache?

Open DevTools, go to the Network tab, click the page request and read the response headers. cf-cache-status: HIT, x-cache: HIT or an age value above 0 means a shared cache served it. Private pages should show DYNAMIC, BYPASS or MISS.

What Cache-Control header should cart and account pages use?

Use Cache-Control: private, no-store. 'Private' tells shared caches such as CDNs not to store the page, and 'no-store' tells browsers not to keep it either. Also avoid caching any response that sets a cookie.

Does WooCommerce cache the cart page?

WooCommerce marks cart, checkout and account pages as not cacheable, and most caching plugins respect that. Problems appear when a plugin, host cache or CDN rule overrides it. Check that those URLs and the cart cookies are in the exclusion lists of every cache layer.

Will excluding cart pages from the cache slow my site?

Only slightly, and only on those pages. Product pages, blog posts and your home page can stay cached. Private pages must be built fresh for each visitor, which is the cost of keeping their data separate.

Does FunnelGuard detect cached pages with another visitor's data?

No, not yet. It is a possible future check. FunnelGuard does run your real journeys on a schedule and can alert you if a step, tracking hit or lead delivery breaks, so a caching change that breaks the journey may show up that way.

Does FunnelGuard catch this?

Could add

Not checked yet: could be added to FunnelGuard.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.