Although this article refers to the Currency Switcher for WooCommerce, the logic described applies to all the Aelia plugins that include a geolocation feature.
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. Currency Switcher 220.127.116.11008 and later have an improved detection mechanism, which allows to detect the visitors' location even when a reverse proxy is in use.
Working with caching
Caching works by saving a copy of site's content and serving it later on. This process skips the page rendering entirely, therefore the geolocation features are not invoked. The main issue with caching is that, out of the box, caching systems and plugins keep one copy of each page in the cache, and they serve it to all visitors. As a result, all visitors will see the same content, regardless of their location or currency selection. To solve this issue, the caching system must be configured to support dynamic caching, or disabled altogether. Please refer to the Further Reading section, below, for more information.