Excluding WooCommerce Pages from Caching

If you run a WooCommerce shop and you’re using a caching plugin on your website – or your host is providing one as a service, like Varnish – make sure caching is disabled for key WooCommerce pages and cookies.

What is Caching?

Caching is ‘saving’ website information and content in the user’s browser on their first visit and displaying that saved page in the future rather than having to pull it from the server. It allows for faster page loading than if the page had to be ‘rebuilt’ from scratch each time the user views it.

But caching has its drawbacks, as you probably know from being told to ‘clear your cache’ to try to fix any website issue. Caching impacts on WooCommerce can include:

  • Users seeing old versions of the checkout page when they try to finish an order
  • Users seeing other users’ carts or finding strange items in their carts
  • Users seeing other users’ account info
  • Issues with WooCommerce checkout pages never loading

WooCommerce logoThese problems can cause your customers to trust your site less as well as privacy issues. But it can be fixed easily by excluding dynamic pages from the cache. Note: some caching plugins automatically exclude cart and checkout pages for certain ecommerce plugins. Check your plugin’s documentation.

How to Disable Caching for WooCommerce in WP Rocket

WP Rocket is a popular commercial caching plugin for WordPress. It does automatically exclude the Cart, Checkout and Account pages automatically, but there are a few more things you need to do.

1. Go to the WP Rocket settings, Advanced Rules.

2. In the Never Cache Cookies section, add the following lines:


3. Save the changes.

Cookies help track products in carts and power the ‘recently viewed’ widget – they need to stay dynamic as they change a lot.

This process should be simliar for different caching plugins.

How to Disable Caching for WooCommerce in Varnish

Varnish is a server-side tool that speeds up website loading as well as providing security protection. Part of its job is to temporarily store the content of your web pages (a cache), which will be served up when a user requests them rather than making a call on your host server (just like the plugin-based caches).

If you have access to the server settings, you can add the following WooCommerce exclusions to Varnish.




store_notice[notice id]

Share this post...

Leave a Reply

Your email address will not be published. Required fields are marked *