Using multiple currency plugins with WP Rocket
In order for currency switching to be compatible with page caching, it must rely on either AJAX (JavaScript) or set a cookie (that can be used either to exclude the page(s) from caching, or to programmatically create different cache files based on the value of that cookie).
That’s because WP Rocket eliminates all PHP/MySQL processes from a page and creates static HTML output instead (as do most other caching plugins).
We already have built-in compatibility for these plugins:
- Aelia Currency Switcher
- CURCY – Multi Currency for WooCommerce
- WooCommerce Currency Converter Widget
- YayCurrency: starting from version 2.0.9
Each of these plugins uses a cookie to store the currency, which allows WP Rocket to create different cache files based on the value of that cookie. We recommend you choose one of these plugins for your site to ensure that currency switching can work properly.
If you opt for using CURCY, you will need to make sure the "Use SESSION" option on their General settings is deactivated.
Heads up!
Keep in mind that when you use any of these plugins the first visit won’t get the cached page. This is because no cache will be served until the cookie is set on the visitor’s browser. See: Why is the first visit not getting the cached page?
If your current plugin is already using a cookie for this, and you want to continue using it, see:
Create Different Cache Files with Dynamic and Mandatory Cookies
Solve display issue with the menu cart
If you are using a menu cart and the currency displayed on it is not working as expected, this could be caused by WP Rocket’s automated feature to Optimize WooCommerce Get Refreshed Fragments.
If that is your case, install the helper plugin below to get this fixed:
📥 Download (.zip): WP Rocket | Deactivate WooCommerce Refresh Cart Fragments Cache
Developers: you can find the code for this plugin on GitHub.