Using WP Rocket On Your Ecommerce Site
WP Rocket is compatible with e-commerce plugins for WordPress such as:
- Easy Digital Download
- iThemes Exchange
Note: These plugins require that some specific pages that carry user-specific data (such as the items in their shopping cart) should not be cached.
WP Rocket automatically excludes the “Cart”, “Checkout”, and “My Account” pages from the cache for the plugins listed above.
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, go to WP Rocket → Advanced Rules and enter the following value in the Never Cache Cookies field:
If you are using Easy Digital Downloads, use the following:
If you are using WP-Ecommerce, use the following: