Hope you've been well.
WooCommerce and W3 Total Cache Not Working? Here’s how to fix it.
2015-08-05 · by sub-Q
On the day of our first issue, a kind user brought to my attention that our store wasn’t letting him buy a Premium Membership. Turns out WooCommerce and W3 Total Cache were not working together, because I hadn’t configured them completely.
If you’re here, maybe I can save you an hour of head-banging.
- When not logged in, a user would go to the product page, click the button to add it to their cart, and then be returned in a flash to the same product page. No “you have successfully added this product to your cart” message. Very confusing. (I could duplicate the behavior in incognito mode.)
- At the time, the site didn’t have a cart link with product count, but if it had, that link label wouldn’t have been updated, either.
- If I manually entered the url to go to the cart (“/cart/”), the product was there, ready for the order to be placed.
This issue is not unusual, and typically a symptom of a cacheing plugin that needs a little more configuration to work with WooCommerce. Mine was W3 Total Cache.
Perhaps not all of this was necessary—some of these leads came from posts > 2 years old—but this is what finally worked for me:
- Adding _wc_session_ to the list of Ignored Query Strings in my WordPress administration area, under Performance > Database Cache:
- Obeying the W3 Total Cache-related instructions at the WooCommerce Codex for Third-Party Plugins: specifically, in my WordPress administration area, under Performance > Minify, added mfunc to the list of Ignored Comment Stems:
- Adding the shop’s URL (plus contents below it) to the list of pages excluded from cacheing under Performance > Page Cache:
(I did this under both Performance > Page Cache AND Performance > Database Cache, PLUS adding cart and checkout to both lists, out of an excessive abundance of caution. However according to WooCommerce documentation, in WC 1.4.2+ you don’t need to explicitly add cart and checkout to either list of excluded pages, and I don’t think it’s totally necessary to add the shop URL to the list of excluded pages under Performance > Database.)
Hope this helps, and good luck!