FOX and WP Rocket: Currency Switcher Not Working With Cache
WP Rocket and a currency switcher collide in a predictable way, and the fix is never "exclude the plugin from optimisation" — that is the advice that circulates and it usually does nothing.
What actually breaks
FOX writes a small inline script into the page holding the visitor's current currency and the rates. The main script, front.js, reads those variables when it runs. WP Rocket's Delay JavaScript execution and Load JavaScript deferred both postpone that inline block — so front.js executes first, finds nothing, and the prices are never redrawn. The browser console shows woocs_current_values is not defined.
This is why excluding front.js from optimisation does not help: the file was never the problem. The inline block before it was.
The settings that fix it
- In File Optimization, add the plugin's inline script to the exclusions for Delay JavaScript execution, not just the file. WP Rocket accepts a string that appears in the inline code — woocs works.
- Leave Combine JavaScript files off while you test. Combining moves the inline block relative to the file and reintroduces the same race.
- In the FOX settings, switch the Cache option on. It tells the plugin the page it is redrawing came from a cache.
- Set Storage to Transient. From v.2.5.0 that combination keeps the key in the browser's localStorage instead of setting a cookie, and a cookie on the first request is what makes an aggressive cache treat every page as personal.
Pages that must never be cached
Cart, checkout and account pages. WP Rocket excludes them by default, but a custom checkout page created by a theme or a checkout plugin often is not on that list. Check it.
If prices are still wrong after all four steps, the cause is usually not WP Rocket at all — read why a currency switcher and a page cache fight each other for the full picture, including CDN-level caching that sits above WP Rocket entirely.
Reference: the original discussion is on our support forum.