Using WP Rocket on your ecommerce site
WP Rocket is compatible with e-commerce plugins for WordPress such as:
- WooCommerce
- BigCommerce
- Easy Digital Download
- iThemes Exchange
- Jigoshop
- WP-Shop
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.
Cart widgets
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:
woocommerce_items_in_cart
If you are using Easy Digital Downloads, use the following:
edd_items_in_cart
If you are using WP-Ecommerce, use the following:
wpsc_customer_cookie