Optimize your WooCommerce store with e-commerce-aware caching.
The WooCommerce preset extends the WordPress preset with e-commerce-specific handling. It ensures product pages are cached while shopping carts, checkout, and customer accounts remain dynamic.
Cached by default:
The WooCommerce preset bypasses:
/wp-admin/*/wp-login.php/cart/*/checkout/*/my-account/*/?add-to-cart=*/?remove_item=*woocommerce_cart_hashwoocommerce_items_in_cartwp_woocommerce_session_*woocommerce_recently_viewedWhen any of these cookies are present with a value, cache is bypassed automatically.
For AJAX mini-cart updates to work:
By default, product variants use the same cached page. The variant selection happens via JavaScript.
If your theme requires different URLs for variants:
/product/t-shirt/?color=red
/product/t-shirt/?color=blue
Enable query string caching in your accelerator settings.
Stock status on cached pages may be stale. Options:
Cached pages show prices at cache time. For price updates:
Use a webhook or cron to purge when prices change:
add_action('woocommerce_product_set_price', function($product) {
// Trigger CDN purge for this product
wp_remote_post('https://nordiccdn.com/api/v1/zones/{uuid}/purge', [
'body' => json_encode([
'type' => 'path',
'paths' => ['/product/' . $product->get_slug() . '/']
])
]);
});
Load current prices via AJAX after page load.
For flash sales with high traffic:
See Waiting Room for queue management.
Group products by category for efficient cache purging:
# Purge entire category
curl -X POST ".../purge" -d '{"type": "path", "paths": ["/product-category/sale/*"]}'
Use a Pull Zone for WooCommerce assets:
// functions.php
add_filter('woocommerce_enqueue_styles', function($styles) {
// Rewrite to CDN URLs
return $styles;
});
The woocommerce_recently_viewed cookie triggers cache bypass. Options:
Before going live, test:
If cart shows wrong items:
If checkout fails:
/checkout/* is in bypass pathswordpress_logged_in_* cookie is present/my-account/* is in bypass paths