The Currency Switcher selects a currency based on the IP when you visit the site for the very first time, then it saves it against the User profile (or session, if the User is not registered) and shows such currency from that moment on. If User manually selects another currency, then such new currency will be stored and used from that moment on.
- Joe visits your site for the first time. He connects from UK. Joe is shown prices in British Pounds.
- Joe then goes on a trip to Germany, bringing his laptop with him. He connects to the site again. He still sees prices in British Pounds, because such currency was stored during his first visit.
- Joe manually changes the currency to Euro. Now the store will display all prices in Euro from that moment on.
- Joe travels to Chicago, and connects to the site again from his laptop. Prices are still displayed in Euro, which was the currency he chose last time, and which is still stored against his session.
- Joe, who never registered on the website, visits it again after a few weeks, while he is still in the United States. His session is now expired, therefore there is no longer a currency stored in it. The site will show him prices in US Dollars.
- Since Joe is planning to return to the UK soon, he changes the prices to British Pounds, places an order and registers on the site. "British Pounds" is now saved on his User profile as his default currency. From this moment on, whenever Joe will visit the site and log in, the currency will automatically switch to British Pounds, unless Joe manually selects another one.
The above mechanism is implemented to provide a consistent experience to the visitors, who will always see the site the way they left it.
Working with reverse proxies
Reverse proxies can speed up a website, but they have the side effect of hiding visitors' IP address. The Currency Switcher implements a mechanism that allows to detect the visitors' location in most cases, even when a reverse proxy is in use.
Working with CloudFlare
CloudFlare implements a special reverse proxy mechanism, which doesn't conform to the standard used by other proxies. To ensure that the Currency Switcher works correctly when CloudFlare is in use, please install and configure the WordPress CloudFlare plugin.