Using WP Rocket On Your Ecommerce Site
WP Rocket is compatible with e-commerce plugins for WordPress such as WooCommerce, Easy Digital Downloads etc
However, there are a couple of pages that should not be included in the cache. This is because data that is specific to a visitor, such as the items in their shopping cart, should not be cached.
Note: As of version 2.4 of WP Rocket, the cart, checkout and 'my account' pages are auto-excluded from the cache for WooCommerce, Easy Digital Download, iThemes Exchange, Jigoshop, and WP-Shop.
In versions of WP Rocket earlier than 2.4 you will need to manually exclude the “View Cart” and “Checkout” pages from the cache. You can do this in the Advanced Settings tab of WP Rocket. In the box labeled Never cache the following pages enter the URLs of the those pages on your site.
For example if your Cart page is located at:
You can enter either
http://www.example.com/cart/ in the box.
Place each page on its own line in the box:
If you have child pages that need excluding you can do so using the following format:
In this example, all child pages of checkout will be excluded.
If you have a cart widget that shows the number of items in your cart, and it does not function correctly with caching, it is probably using PHP to update the item total, and therefore must be excluded based on a cookie (see below). Some cart widgets use AJAX and will work fine with caching. For example, since WooCommerce 2.0 their standard cart widget uses AJAX and is compatible with caching.
You can view their documentation to add an AJAX cart total to your theme if you don't have one.
We also have a tutorial on our blog:
Exclude Based On Cookies
Pages can be excluded from the cache based on the presence of a cookie.
For example, if you are using WooCommerce with a PHP-driven cart widget, you can go to the Advanced tab in WP Rocket and in the box labelled Don't cache pages that use the following cookies you can enter the following:
If you are using WP-Ecommerce, you can enter the following: