Configuring caching plugins

Excluding pages from the cache ↑ Back to top

If using caching plugins, make sure you exclude the following pages from the cache through their respective settings panels:

  • Cart
  • My Account
  • Checkout

These pages need to stay dynamic since they display information specific to the current customer.

Due to the number of available caching options, we have previously listed some here but we’re unable to cover all options. For more specific support, please reach out to the support team responsible for your caching integration.

W3 Total Cache Minify Settings ↑ Back to top

Ensure you add ‘mfunc’ to the ‘Ignored comment stems’ option in the Minify settings.

Screen Shot 2014-06-03 at 16.15.30

WP-Rocket ↑ Back to top


WooCommerce is fully compatible with WP-Rocket. No extra configuration is needed. All WooCommerce pages are automatically detected and not cached.

We recommend avoiding JavaScript files minification.

WP Super Cache ↑ Back to top

WooCommerce is compatible with WP Super Cache. Please ensure that the following pages (Cart, Checkout, My Account) are not to be cached by placing the corresponding endpoints here WP Admin > Settings > WP Super Cache > Advanced.


Varnish ↑ Back to top

if (req.url ~ "^/(cart|my-account|checkout|addons)") {
 return (pass);
if ( req.url ~ "\?add-to-cart=" ) {
 return (pass);

Why is my Varnish configuration not working in WooCommerce? ↑ Back to top

Check out the following Support forum post on how cookies may be affecting your varnish coding.

Add this to vcl_recv above "if (req.http.cookie) {":

# Unset Cookies except for WordPress admin and WooCommerce pages 
if (!(req.url ~ "(wp-login|wp-admin|cart|my-account/*|wc-api*|checkout|addons|logout|lost-password|product/*)")) { 
unset req.http.cookie; 
# Pass through the WooCommerce dynamic pages 
if (req.url ~ "^/(cart|my-account/*|checkout|wc-api/*|addons|logout|lost-password|product/*)") { 
return (pass); 
# Pass through the WooCommerce add to cart 
if (req.url ~ "\?add-to-cart=" ) { 
return (pass); 
# Pass through the WooCommerce API
if (req.url ~ "\?wc-api=" ) { 
return (pass); 
# Block access to php admin pages via website 
if (req.url ~ "^/phpmyadmin/.*$" || req.url ~ "^/phppgadmin/.*$" || req.url ~ "^/server-status.*$") { 
error 403 "For security reasons, this URL is only accesible using localhost ( as the hostname"; 

Add this to vcl_fetch:

# Unset Cookies except for WordPress admin and WooCommerce pages 
if ( (!(req.url ~ "(wp-(login|admin)|login|cart|my-account/*|wc-api*|checkout|addons|logout|lost-password|product/*)")) || (req.request == "GET") ) { 
unset beresp.http.set-cookie; 
If you would like to learn more about how to use Varnish code, please visit their website on how to install it on your server.

Why is my Password Reset stuck in a loop? ↑ Back to top

This is due to the My Account page being cached, Some hosts with server-side caching don’t prevent my-account.php from being cached.

If you’re unable to reset your password and keep being returned to the login screen, please speak to your host to make sure this page is being excluded from their caching.

WooCommerce - the most customizable eCommerce platform for building your online business.

Back to the top