Using multiple currency plugins with WP Rocket
In this article, you will learn how to use multiple currency plugins along with WP Rocket. There is a brief introduction, a list of compatible plugins, and other useful information.
Overview
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).
Compatible plugins
WP Rocket has 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
- WooCommerce Multilingual & Multicurrency add-on for WPML
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.
Recommendation for CURCY
If you opt for using CURCY, you will need to make sure the "Use SESSION" option on their General settings is deactivated.
Cache is not delivered in the first visit
Keep in mind that when you use any of these plugins, the first visit won’t get the cached page because:
- No cache will be served until the currency cookie is set on the visitor’s browser. See: Why is the first visit not getting the cached page.
- This implementation is not compatible with the Preload option.
Other plugins and custom implementation
If you are using a different plugin from this list, and if it's using cookies to manage the currencies, you could make your own custom implementation by following this guide:
Create different cache files with dynamic and mandatory cookies
Wrong currency in the cart
If you are using a menu cart and the currency displayed on it is not working as expected, please try the following solutions:
- Install the helper plugin found in the Optimize WooCommerce get refreshed fragments article.
- If you use Delay JavaScript execution, check the
WooCommerce - Cart Fragments
box in the One-click exclusions section.