Magento 2 Store and Currency Auto Switcher Manual¶
Introduction¶
Store and Currency Auto Switcher adds the global flexibility to your Magento 2 store. The extension allows you to automatically switch currency based on user location, convert prices to customers’ local currencies and more. GeoIP automatically detects customers country and city in real time and the extension changes the prices accordinally.
Requirements and Installation¶
Store and Currency Auto Switcher supports Open source (Community), Commerce (Enterprise) editions and Commerce cloud. The current version of the Magento installed on your website can be found in the lower right corner of any backend page.
Store and Currency Auto Switcher has 3 separate ways of installation:
1) Copy the code (ready-to-paste package);
2) Use MageWorx Repository;
3) Use local Composer.
Currency Options in Magento 2¶
Log into the Magento Admin panel and go to STORES ⟶ Configuration ⟶ GENERAL ⟶ Currency Setup.
Base Currency specifies the currency to be used for all online transactions in the store.
Default Display Currency sets the currency to display by default in the store.
Difference between Default Display Currency and Base Currency
Default Display Currency doesn’t affect the Base Currency. All the transactions will be held in the Base Currency.
Extension Configuration¶
Log into the Magento Admin panel and go to STORES ⟶ Configuration ⟶ MAGEWORX ⟶ GeoIP Extensions. The extension's configuration consists of 5 tabs.
GeoIP DataBase¶
The GeoIP extension uses free MaxMind GeoIP database to determine locations of your visitors and switch the store view/website and/or the currency.
The Database Type - City allows displaying a customer's region and city (detected by IP) in the order view.
Due to new MaxMind policy, you should register an account at MaxMinde site and generate a new license key for GeoLite2 database and enter it in the "MaxMind License Key" field.
Note
You should use the following option, when generating the licence key: "Generate a license key and config file for use with geoipupdate versions older than 3.1.1. This key will be stored in an unhashed format."
Note
You should save the configuration after adding a license key first. If you click the Update Database button before saving the configuration, it will update the database of the previous type with the previous license key.
Customer Location¶
Enable in Order View setting enables or disables customer's current location in the Order View.
Currency Switcher¶
User Agent List – the list of user agents the currency won’t be switched for. This includes search and social networks bots.
Exception URLs provides the list of the website URLs to disable the Currency Switcher for.
Store Switcher¶
-
Store Auto Switcher Scope setting defines if the switcher works within one (Website option) or multiple websites (Global).
-
Disable Key is defined to create the URL pattern, which disables the Switcher. For example, if the store owners need to browse the site without redirects, they can add the
?_store_switcher=key
to the URL. -
Exception URLs provides the list of URLs, to disable the Store Switcher for. The store owner may need to add the URLs of the payment processing gateways.
-
Auto Switch Country enables or disables the automatic country switching.
-
Show Popup To Switch Country displays the redirect confirmation pop-up if the auto switch country setting is disabled.
-
Popup message specifies the text shown in the redirect confirmation pop-up. You can use the following variables: [store_view_name], [website_name], [customer_store_view_name], [customer_website_name], [country], [region].
-
Popup button text specifies the text on the call-to-action button in the redirect confirmation pop-up. You can use the following variables: [store_view_name], [website_name], [customer_store_view_name], [customer_website_name], [country], [region].
-
Close popup text specifies the text on the close-link in the redirect confirmation pop-up. You can use the following variables: [store_view_name], [website_name], [customer_store_view_name], [customer_website_name], [country], [region].
-
IP List is the list of IP addresses for which the Store Switcher should be disabled (may be useful for testing purpose).
-
User Agent List inclides the agents to disable store view switching for. This includes search and social networks bots.
-
Choose Country feature allows testing the site from any chosen country. To enanble this feature, select a country from the list and click the View Site button.
Geo Lock¶
If the clients observe some problems after the installation of the extension. they can easily disable its functionality by selecting No in the Enabled configuration setting.
From here, the store owner can either Allow access to some peculiar countries or Deny it for some regions. To select several countries one by one, hold the Ctrl key and click the items one by one. To select a group, hold the Shift key and select the first and the last option.
Both White List and the Black List can be filled in here. The wildcard symbol * can be used for IP arrays.
Special Cases
-
If both whitelist and blacklist are populated, then only the whitelist will be used (only the mentioned IPs will be allowed to view the website, the Geo Lock by countries wouldn't be taken into consideration).
-
If the same IP is in the white list and the black list, then it will be allowed as the whitelist has the higher priority.
-
If the store owner IP is specified in the blaclist, or is not provided in the whitelist, or is blocked in the countries settings, the frontend will be locked.
Nevertheless, the admin page will still be accessible so it can be removed without any problems.
Currency Auto Switcher¶
The extension has 3 separate configuration pages.
Currency Rates¶
Log into the Magento Admin panel and go to STORES ⟶ Currency ⟶ Currency Rates.
The currency rates values can be set manually in relation to the base currency or automatically.
The store owner can input the desired rates in the appropriate boxes or select the desired rates provider in the Import Service dropdown and click the Import button. After that, click the Save Currency Rates button.
Currency Symbols¶
Log into the Magento Admin panel and go to STORES ⟶ Currency ⟶ Currency Symbols.
From here, the store owner can change the desired currency symbol. This configuration page allows the store owner to use the default currency symbols or change them to the custom ones.
Currency Relations¶
Log into the Magento Admin panel and go to STORES ⟶ Currency ⟶ Currency Relations.
This section manages the Country-Currency relations. The store owner can add a new currency and set a list of countries for which this currency should be applied. After configuration, hit the Save Currency Relations button.
Currency Auto Switcher switches only the displayed currency
All the transactions will still be processed in the Base Currency.
Store Auto Switcher¶
Store-country management¶
The extension extends the default functionality of the store management. To setup the store Switcher the store owner should go to STORES ⟶ Settings ⟶ All Stores and select the desired store.
The extension adds Countries tab that sets the countries for the corresponding store.
If the GeoIP City is selected in the extension's configuration, the store owner can make even more precise fine-tuning as the countries regions can be used for the switching rules.
Setup overview¶
The extension allows you to overview the store-country-currency setup in one grid. For this go to STORES -> Stores & Currenct Relations Grid. Here you can see what country is assigned to every store and what currency is default for this setup.
Varnish compatibility¶
If you have Varnish on your server you will need to add the following code snippet to the Varnish config:
```
Ignore cache if "geoip_store_code" cookie is missing¶
if (req.http.cookie !~ "geoip_store_code=") {
return (pass);
}
```
Got Questions?¶
Need help with the extensions? Feel free submit a ticket from https://www.mageworx.com/support/
Mageworx offers outstanding services developing custom-tailored solutions for Magento platform to attain your eCommerce objectives. Our professional impassioned team provides profound and custom oriented development of your project in a short timeframe.