How to configure W3 Total Cache to use with WooCommerce?

WooCommerce is still the king of online e-commerce for small businesses. In any platform, website performance is one of the key criteria for the search engines. To make it a high-performance website the caching mechanism is really important.

In the WordPress ecosystem, there are really good plugins out there for caching the site. One of the prominent caching plugins is W3 Total Cache. W3 Total Cache plugin works flawlessly with WooCommerce if we can set it properly.

WooCommerce doc has some instructions about it. Latest WooCommerce handles it in a way so that the WooCommerce pages are not cached by W3 Total Cache.

When we are setting WooCommerce with W3 Total Cache we can check the following settings:

  • Exclude WooCommerce Pages from Caching (Woocmmerce sets the DONOTCACHEPAGE, constant to their pages but you should confirm that)
  • Add mfunc in ignored comments stems for HTML minification. In Performance>Minify add mfunc to “Ignored comment stems” text box under “HTML & XML” section.
  • Exclude Woocomerce JS and CSS files from being minified or use Manual minify and add JS and CSS files manually, excluding the Woocommerce files.
  • Add all WooCommerce pages for not minifying. Add those files in Performance>Minify, “Never minify following pages” text area. This step is optional and should be performed only if required due to the setup.
  • Add _wc_session_ in “ignored query stems” field in Performance>Database Cache, Advanced sub-box

Source:
Do not cache WooCommerce