Multi-currency for WooCommerce is an extension that provides switching currencies and re-calculating rates on-the-fly. This document explains how Multi-currency uses Geolocation to set the currency.
Initial currency setting
↑ Back to topWhen someone comes to your website for the first time, or from a different device/browser, Multi-currency attempts to detect the visitor’s country. That process is called geolocation, and it’s a standard WooCommerce procedure.
For geolocation to work, you need to enable and set it up in the Admin -> WooCommerce -> Settings.
Please read the documentation on how to do it here: https://woocommerce.com/document/maxmind-geolocation-integration/
- If the visitor’s country successfully detected by WooCommerce, Multi-currency looks up the currency of that country. For example, if the country is the USA, the currency is USD, for Germany it will be EUR, for Australia – AUD and so on.
- If the detected currency is not one of those you enabled for your website, Multi-currency assigns the Fallback Currency to the visitor.
- Then, the currency is saved in a browser’s cookie.
The cookie name iswoocommerce_multicurrency_forced_currency
. - At the following visits to the site from the same browser, Multi-currency will use the currency code from the cookie. Multi-currency will not use geolocation from now on.
Switching currency
↑ Back to topIf you placed a currency switcher on your site (widget, menu, shortcode), the site visitors can change the currency.
The selected currency is stored in the same cookie, replacing the old one.
Next time, the visitor will see the prices in the selected currency.
Logged-in users
↑ Back to topFor the users with an account, Multi-currency saves the selected currency in their User Profile.
This brings the persistence regardless of the browser/device they are using. Upon login, they receive their preferred currency.
Multi-currency and Multi-lingual sites
↑ Back to topIf your website is running WPGlobus or Polylang, there is an option to link language to currency.
For example, if your website sells in USA and Mexico, you may link English to USD and Spanish to MXP.
When the visitor chooses Spanish, Multi-currency automatically sets the currency to MXP.
The selected language is also stored in a cookie, woocommerce_multicurrency_language
.
Checking that Geolocation works correctly
↑ Back to topVPN and online tools
↑ Back to top- VPNs suppose to “fake” your real location and make the website see you as a visitor from another country. Some had success using a VPN, others reported incorrect geolocation. Probably, it depends on the specific VPN and how WooCommerce/MaxMind treats it.
Remember to test using an incognito browser window, or clear the cookies before testing. Do not log in. - Online tools like https://geopeeker.com/ are able to show how your site looks when browser from different locations. Usually, the results are correct.
Multi-currency debug
↑ Back to top- On the Multi-currency settings page, set logging to Debug
- Look at the logs to see the visitors’ IP addresses and the assigned currency
- You can use https://who.is/ to check which country an IP belongs to
- Do not forget to switch logging back to Errors after you’ve done with checking!