Caching & Performance
Dino Discounts is built with aggressive caching internally, but it also needs your full-page caching plugin configured correctly.
Internal caching
Section titled “Internal caching”The plugin handles its own performance optimisation:
Cart fingerprinting
Section titled “Cart fingerprinting”Every time the cart is evaluated, the engine creates a fingerprint (hash) of the cart contents, quantities, customer data, and applied coupons. If the fingerprint hasn’t changed, the previous result is reused — no recalculation.
Discount caching
Section titled “Discount caching”Discount definitions are loaded from the database once and cached in WordPress transients. Discount changes invalidate the cache automatically when you publish.
Zone caching
Section titled “Zone caching”Zone definitions (country → zone mappings) are cached similarly. Changes to zones invalidate the cache on publish.
You don’t need to configure any of this — it works automatically.
Full-page caching compatibility
Section titled “Full-page caching compatibility”If you use a full-page caching plugin, URL exclusions alone are not enough. The 2026-04-29 setup audit (WP-Optimize 4.5.0) showed that excluding only /cart/ and /checkout/ still breaks the storefront, because /?add-to-cart=… is treated as a homepage request and served from the cached homepage HTML — so the WooCommerce session cookie is never set and the cart stays empty for every guest.
To work end-to-end, the cache plugin needs three sets of exclusions:
1. URL patterns to bypass the cache
Section titled “1. URL patterns to bypass the cache”/cart— the cart page/checkout— the checkout page/my-account— the customer account area
Configure each in your cache plugin’s URL / page exclusion list:
- WP Rocket — Add to “Never Cache (URLs)”
- WP-Optimize — Add to “URLs to exclude from caching”
- WP Super Cache — Add to “Rejected URI Strings”
- W3 Total Cache — Add to “Never Cache” pages
- LiteSpeed Cache — Add to “Do Not Cache URIs”
- SiteGround Optimizer — Add to cache exclusion list
2. Cookies that should bypass the cache
Section titled “2. Cookies that should bypass the cache”If any of these cookies is set, the cache plugin must serve a fresh (uncached) page rather than the cached HTML — otherwise the cart page reflects the wrong session:
wp_woocommerce_session_(prefix — the per-customer WC session cookie)woocommerce_items_in_cartwoocommerce_cart_hashwordpress_logged_in_(prefix — present for any logged-in user)
Configure these in the “Never cache pages with these cookies” / “Bypass cache on cookie” list in your cache plugin.
3. Query variables that should never be cached
Section titled “3. Query variables that should never be cached”WooCommerce’s add-to-cart / coupon-apply flow rides on query parameters that must NOT be cached, or the action is silently ignored:
add-to-cartremove_itemundo_itemapplied_couponremoved_coupon
Configure these as “Never cache URLs containing these query strings” / “Exclude query strings from caching”.
Why this matters
Section titled “Why this matters”Full-page caching serves a saved copy of the page to every visitor. With the wrong configuration:
- Discounts appear to not apply (the storefront shows a cached pre-discount cart)
- Wrong discount amounts (a stale cart hash is served to a different session)
- Other customers’ cart contents may be visible in extreme cases
- “Add to cart” silently does nothing (the
add-to-cartquery is cached as part of the homepage URL)
Purging the page cache when discounts change
Section titled “Purging the page cache when discounts change”When you publish a rule change (or any setting that affects discount evaluation), the plugin fires the dino_discounts_cache_flush action. Page-cache plugins that don’t already detect WooCommerce rule changes — or a custom snippet on your site — can subscribe to this hook and clear their full-page cache when discounts move:
add_action( 'dino_discounts_cache_flush', function () { // Replace with your cache plugin's purge call. if ( function_exists( 'rocket_clean_domain' ) ) { rocket_clean_domain(); }} );Without this hook, a published rule change won’t reach customers until the cached pages naturally expire.
Object caching
Section titled “Object caching”Dino Discounts works fine with object caching (Redis, Memcached). WordPress transients are stored in the object cache when available, which makes discount and zone loading faster.
No special configuration is needed.
CDN compatibility
Section titled “CDN compatibility”CDNs (Cloudflare, Fastly, etc.) that cache HTML pages need the same cart/checkout exclusion as full-page caching plugins. Most CDN setups already exclude these pages, but verify yours does.
API calls (/wp-json/dino-discounts/v1/*) should never be cached by your CDN. Most CDN configurations exclude /wp-json/ by default.