Caching WooCommerce correctly, and what must never be cached

Caching is the biggest performance win available to a shop, and the fastest way to break one. The rule is simple: cache what is the same for everybody, never cache what is personal.

Never cache these pages

  • Cart
  • Checkout
  • My Account

If these are cached, one customer sees another customer's basket, or their name and address at checkout. Most caching plugins exclude them automatically, but you must confirm it rather than assume – particularly if your pages use non-standard names or you are on a non-English site where the slugs differ.

Also exclude

  • Any page carrying order details, such as order-received
  • Anything behind a login
  • The WooCommerce API and AJAX endpoints

Cookies matter

WooCommerce sets cookies when a basket has something in it. A properly configured cache will bypass itself for a visitor carrying those cookies, so a shopper with items in their basket always gets a fresh page. If your cache ignores cookies, the mini-basket in the header will show the wrong contents – the classic symptom of caching set up without regard for WooCommerce.

Testing it

Add something to the basket in a private browser window, then open the shop in a different browser entirely. The second browser must show an empty basket. If it shows the first browser's items, stop and fix the cache before going any further.

What to cache

Product pages, category pages and the home page – the pages that are identical for everyone and make up the bulk of your traffic.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

WooCommerce on shared hosting: what to expect

WooCommerce runs perfectly well on shared hosting for the great majority of shops. It is,...

Order emails are not arriving

Missing order emails are among the most damaging faults a shop can have, because neither you nor...

Action Scheduler: why background jobs stop running

WooCommerce queues work to run in the background – sending some emails, syncing stock,...

Orders stuck on pending payment

An order sitting at Pending Payment means WooCommerce created it and never heard that the payment...

Preparing your shop for a sale or a traffic spike

A planned spike – a sale, a newsletter, a product launch – is the one kind of traffic...