Getting Started

Configuring WP Rocket for Super Speedy AJAX Prices

Published · Last updated

WP Rocket and Super Speedy AJAX Prices are a strong pairing: Rocket caches your catalogue pages hard, and this plugin makes sure every visitor still sees their correct price on those cached pages. Because the prices request is never cached and carries no nonce, you can push Rocket far more aggressively than a WooCommerce store normally dares — long cache lifespans, full preload, even serving one cached page to everyone — and prices stay correct.

This guide covers the Rocket-specific settings that matter. For the universal cache rules that apply to any cache, see Caching Plugin Configuration; for picking a delivery method, see Choosing an Ajax Type.

The single most important setting: WP Rocket’s Delay JavaScript Execution will, by default, delay this plugin’s script until the visitor interacts with the page — which means prices don’t update until they scroll or click. You must exclude the plugin’s script from Delay JS. See File Optimization below. If you configure nothing else, configure this.

1. Pick an Ajax Type that suits Rocket

  • Normal Ajax or Fast Ajax (recommended with Rocket). These use admin-ajax.php, which Rocket never caches — so there is zero page-cache configuration to get wrong, and they’re the most compatible with WooCommerce pricing/membership plugins.
  • Normal REST / Fast REST / Ultra Ajax. These use a REST-style or bypass endpoint. The prices request is always a POST, and Rocket does not cache POST requests, so it won’t be cached either — but if you also run an edge/CDN layer that caches REST, exclude /wp-json/ssap/. Also confirm the type actually returns your dynamic prices first (the Benchmark), as REST is the least compatible transport.

For most WP Rocket stores, Fast Ajax is the sweet spot: no cache config, full plugin compatibility, and it skips loading your other plugins on the price request.

2. File Optimization (the part that breaks prices if you get it wrong)

WP Rocket → File Optimization.

Delay JavaScript Execution — required exclusion

Rocket delays all JavaScript until the first user interaction. Add the plugin’s script to the exclusion list so prices fetch immediately on load, not on interaction.

  • Delay JavaScript Execution → “Excluded JavaScript Files”, add:
  /super-speedy-ajax-prices/

(or more specifically ssap-pricing.js). This matches the front-end script …/super-speedy-ajax-prices/assets/js/ssap-pricing.js.

  • The script depends on jQuery. If you exclude the SSAP script but prices still don’t fire, also exclude jQuery from Delay JS (jquery.min.js / jquery-migrate), since a delayed dependency delays the dependant.

How to tell it’s working: load a cached category page, do nothing, and watch DevTools → Network. The ssap_get_prices request (or your type’s equivalent) should fire within a moment of load, and prices should get the ajax-price-loaded class without you interacting. If it only fires after you click/scroll, the exclusion isn’t matching.

Common mistake

Leaving this plugin’s script under Delay JavaScript Execution. Prices then wait for the visitor to scroll or click before they update – add /super-speedy-ajax-prices/ (and jQuery if needed) to the Delay JS exclusions.

Load JavaScript Deferred — safe

Deferring is fine. The script runs on DOMContentLoaded and is enqueued in the footer, so “Load JavaScript deferred” does not break it. Leave it on.

Minify / Combine JavaScript — usually safe

Minifying is fine. Combining is usually fine, but if you see prices stop updating after enabling Combine JavaScript files, add the same /super-speedy-ajax-prices/ exclusion under the combine settings (or turn combine off — on HTTP/2 it rarely helps anyway).

Remove Unused CSS (RUCSS) — safelist the display styles

If you use a Dimmed or Spinner display mode, RUCSS can strip the plugin’s display-mode CSS as “unused above the fold”, so the dim/spinner won’t show (prices still load correctly — only the loading appearance is affected). Under Remove Unused CSS → “CSS Safelist”, add:

.ajax-price
.ajax-price-placeholder
.ssap-mode-reveal
.ssap-mode-spinner
.ssap-mode-text

Or, more simply, safelist the stylesheet filename ssap-pricing. If your display mode is Loading text or you’ve left prices fully visible, you can skip this.

3. Page cache rules

WP Rocket → Advanced Rules, plus the WooCommerce integration Rocket enables automatically:

  • Cache shop, product and category pages — do not add them to “Never Cache (URLs)”.
  • Never Cache (URLs): cart, checkout, my-account are excluded automatically by Rocket’s WooCommerce add-on. Confirm they’re listed.
  • The prices request runs over admin-ajax.php (or a POST endpoint) and is never cached by Rocket — nothing to add.

4. Go aggressive (this is where the pairing pays off)

Because the price is fetched live per visitor and the endpoint uses no nonce, cached HTML never goes stale in a way that breaks pricing. That lets you turn Rocket up:

  • Cache Lifespan: you can safely set a long lifespan (or even clear-on-demand only). Nonce-based approaches break after ~12–24h as the baked-in nonce expires; this plugin has no nonce, so a page cached for days or weeks still fetches correct prices. Longer lifespan = higher hit rate = faster site.
  • Preload: leave Preload and Sitemap preload on. Rocket preloads pages as a guest, so the cached HTML holds guest prices — exactly what this plugin is built to correct on the fly. Preloading gives every visitor a warm, fully-cached page.
  • Logged-in visitors. Rocket bypasses the cache for logged-in users, so their pages render correct prices server-side and Ajax prices for logged-in users can be turned off. Leave it on if Rocket is caching for logged-in users, so members get their own price rather than the one baked into the page.
Performance Tip

Because the endpoint carries no nonce, a page cached for days or weeks still fetches correct prices – so you can set a long cache lifespan and leave preload on. Higher hit rate, faster site, no stale-pricing risk.

Note

Everything on this page concerns caching pages for ordinary visitors, where the price is the per-visitor part. Serving one shared cached page to logged-in customers, or to visitors carrying a basket, is a bigger job: that HTML carries every personalised part of the markup, not just the price, so it takes compatibility work on your theme and plugin stack. We do that as a service – request a compatibility assessment.

5. CDN / RocketCDN

  • Serve your static assets (CSS/JS/images) via RocketCDN or your CDN as normal — the plugin’s script and styles are ordinary static files.
  • Do not route admin-ajax.php through the CDN, and if you chose a REST/Ultra Ajax type, exclude /wp-json/ssap/ (and the Ultra endpoint) from any edge full-page caching. The universal rule “never cache the prices request” applies at the edge too.
  • On an edge “cache everything” setup, the client-side Ajax prices with a cart safety net (it reads the woocommerce_cart_hash cookie in the browser) is worth keeping on, since edges often ignore the cart cookie.

6. Verify

  1. Open a category page in a private window; reload twice. Confirm the HTML is a Rocket cache hit — Rocket adds an HTML comment near the end of the source, <!-- Performance optimized by WP Rocket… --> with a “cached for … visitors” note (visible in View Source, not in a response header).
  2. In DevTools → Network, confirm the ssap_get_prices request returns fresh JSON every load (not cached) and that prices gain ajax-price-loaded without any interaction.
  3. Log in as a customer who gets special pricing and confirm they see their price on the (cached) catalogue.
  4. Run the plugin’s Benchmark as a guest and as that customer to confirm your chosen Ajax Type returns correct prices and to see the speed gain.

Quick troubleshooting

SymptomCauseFix
Prices only update after I scroll/clickDelay JavaScript Execution is delaying the scriptAdd /super-speedy-ajax-prices/ to Delay JS exclusions (and jQuery if needed)
Prices never update at allCombine JS broke the script, or the script isn’t loadingExclude /super-speedy-ajax-prices/ from Combine; check the browser console
No dim/spinner while loading (prices still correct)RUCSS stripped the display-mode CSSSafelist ssap-pricing / the .ajax-price* and .ssap-mode-* classes
Members see the guest price on cached pages“Ajax prices for logged-in users” turned off while serving them cached pagesTurn it back on
REST/Ultra type shows base pricesREST transport skips the WooCommerce customer/session some plugins needUse Fast Ajax; verify with the Benchmark

Further reading

the same delay-JS exclusion for Perfmatters and any other optimiser, not just Rocket.
the universal cache rules behind these Rocket-specific ones.
why Fast Ajax is usually the sweet spot with Rocket.
verify your chosen type returns correct prices and measure the gain.
other plugins that need special handling on cached pages.

Comments

▲
▼
1/1