Opt out of cache when WooCommerce cart isn’t empty
-
Hi!
Really wonderful plugin that I’ve been successfully using on countless sites for years.I’ve encountered a situation when using WooCommerce, eventhough cart and checkout pages are not cached by defaults, when there’s a “mini-cart” in the header, unless it’s synced after inital page load by an AJAX query, as the page is cached, the mini cart article count and content are always empty, as they are returned as part of a cached page.
To circumvent this issue, I have added “woocommerce_items_in_cart” in the
.htaccess
so that this line:
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
becomesRewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_|woocommerce_items_in_cart).*$
.It works like a charm, but I’d be really awesome for all WooCommerce users to have a related options in the configuration section.
- The topic ‘Opt out of cache when WooCommerce cart isn’t empty’ is closed to new replies.