Repository navigation
WooCommerce
A shop is the hardest kind of site to cache: most pages are the same for everyone, and a few must never be shared. Ace Redis Cache detects WooCommerce and applies its shop rules without being asked. The WooCommerce tab on the settings screen appears only when WooCommerce is active.
These are refused by the plugin and by the early-serve drop-in, before any setting is consulted:
- The basket, checkout and account pages, under your site's own slugs
- Order pay, order received and view order pages
- Requests with
?wc-ajax=,?add-to-cart=,?remove_item=or?undo_item= - The Store API basket and checkout routes
- Any request carrying a basket or WooCommerce session cookie
In short: the moment a visitor has something in their basket, they get live pages. Before that, shop, category and product pages are served from the cache like any other page.
WooCommerce also marks its own private pages with DONOTCACHEPAGE, which the plugin honours. See Page cache.
| Data | Treatment |
|---|---|
| Sessions, notices and counts | Never stored in Redis |
| Products, terms, options, shipping and tax data | Shared, stored by guest requests |
| Basket and checkout requests | Never write to Redis |
By default a basket or checkout request does not read Redis either, so it re-reads shared product and shipping data from the database. Basket and checkout object cache reads lets those requests read the shared data from Redis while still never writing. It is off by default. Product and price freshness is the same as on the front end, because a save invalidates the same keys.
| Setting | Default | What it does |
|---|---|---|
| Cached pages for logged-in customers | off | Signed-in customers share one cached copy of shop, product and content pages. See the warning below. |
| Basket and checkout object cache reads | off | As described above |
| Cart Cookie on Product Pages | on | Stops WooCommerce setting its basket cookie on product, shop and category pages, so guests there stay cacheable |
| Persistent Cart | on (disabled) | Turns off WooCommerce's persistent basket writes. Session baskets still work; they do not survive a browser restart. |
| Variation AJAX Threshold | 15 | WooCommerce's default is 30. Lower values load large variation sets over AJAX sooner and keep product pages lighter. |
| Action Scheduler Limits | 15 s, 10 per batch | Caps background job batches so they do not hold long-running cron requests |
| Skip Variation Children on Archives | on | Stops product grids expanding every variation of every product |
| Skip Composite Sync on Archives | on | Stops composite products recalculating prices for every item in a grid |
| WooCommerce URL Exclusions | on | Excludes the standard endpoints from page caching |
Leave this off if prices, stock or content differ from one customer to the next: wholesale or role pricing, customer-specific catalogues, tax shown by address. A shared copy cannot be right for all of them.
It is safe when every customer sees the same shop. Anyone with a basket still gets live pages, as does every basket, checkout and account page.
Product grids are among the slowest blocks to render. The block cache stores them and replays them with the scripts and state they need, so add to basket, quantities and variations keep working. It is off by default.
Stored product blocks are refreshed when a product they showed is saved, restocked or repriced.
| Change | Refreshed |
|---|---|
| A product or variation is saved, or its stock changes | The product page, the listings that show it, and any composite product that offers it |
| A product attribute or attribute term is added, renamed or deleted | The whole site, since filters and comparisons everywhere show it |
These run wherever the change came from: wp-admin, the REST API, WP-CLI or a stock sync.
After the cache is cleared, the best-selling products (20 by default) are rendered again in the background, so the pages most visitors want are ready first. Filter the list with aceredis_woocommerce_warm_urls.
- Signed out, with an empty basket, load a product page twice. Expect
X-AceRedisCache: HIT. - Add the product to the basket. Load the product page again. Expect a live page.
- Load the basket and checkout. Neither should ever say
HIT. - Complete a test order and check the order received page shows the right order.
If step 2 still shows HIT, something in front of WordPress is removing the WooCommerce cookies before PHP sees them. Check your proxy or CDN rules.
Ace Redis Cache: a page cache and object cache for WordPress, backed by Redis or Valkey. Written and maintained by Shane Rounce at AceMedia. Website · Repository · Issues · GPLv2 or later
Setting up
The caches
Your stack
Reference
Help
