Search

Configuring caching plugins

Excluding pages from the cache ↑ Back to Top

If using caching plugins (such as WP Super Cache or W3 Total Cache) make sure you exclude the following pages from the cache through their respective settings panels – these pages need to stay dynamic since they display information specific to the current customer:

  • Cart
  • My Account
    • Change Password
    • Edit Address
    • View Order
  • Checkout
    • Pay
    • Order Received
Note, WC 1.4.2+ sets the DONOTCACHEPAGE constant which should mean you can skip this step

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

 

Varnish ↑ Back to Top

if (req.url ~ "^/(cart|my-account|checkout|addons)") {
 return (pass);
 }
if ( req.url ~ "\?add-to-cart=" ) {
 return (pass);
 }
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.

HTML Compression/minification plugins ↑ Back to Top

You should thoroughly test plugins which minify html when using them in combination with caching plugins. We include a HTML comment to prevent the caching of the cart widget in the sidebar – some minification plugins strip this comment causes the cart widget to be cached.

WP-Rocket ↑ Back to Top

WooCommerce 2.1+ is fully compatible with WP-Rocket. No extra configuration is needed. The “My Account” pages are automatically detected and not cached. However you should exclude cart and checkout pages from caching. This can be done from the advanced option “Never cache the following pages” by adding the following values:

  • /cart/
  • /checkout/(.*)
Back to the top