Setting up a Magento 2 website switcher can enhance the shopping experience for your international customers, as it enables them to switch easily between multiple store views, languages, or currencies, based on your configuration.
A website switcher is an extension that allows online merchants to provide their customers with options to change the storefront as per their preferred language, currency, or region. It enhances user experience through localized and personalized shopping experiences.
To set up multiple websites, stores, and store views in Magento 2, follow the steps outlined below:
First, install the extension here to begin customizing your application and tailoring its functionality to better suit your needs.
Then you’ll need to install a GeoIP database to make sure that the module works correctly and detects the visitor's location.
To install the GeoIP database, go to Stores → Configuration → Amasty Extensions → GeoIP Data.
Hit the Download and Import button to make the extension download or update SQL dump file and import it into your database automatically.
Note: In Download and Import mode, disregard the error notification in the Import section when CSV files are absent. These files aren't necessary, and the import will still proceed.
To import files from your own source, use the Import option. Path to the files should look like this (the part 'var/amasty' should be replaced with your folders’ names):
var/amasty/geoip/GeoLite2-City-Blocks-IPv4.csv
var/amasty/geoip/GeoLite2-City-Locations-en.csv
In the Import section, the Import button is grayed out by default. It will be available right after you upload the CSV files. The red error notification will switch to green success notification when the import is completed.
The database included in the extension was last updated on October 24, 2023. To keep the IP database current, you can update it using one of two methods.
Please note that regardless of the updating method chosen, you need to import the IP database first.
Refresh IP Database –select the appropriate method for refreshing the IP database:
To configure the Store Switcher extension, go to Stores → Configuration → Amasty Extensions → GeoIP Redirect.
First, expand the General section.
Enable GeoIP Redirect– enable or disable the Store Switcher module.
Then, proceed to the Restriction section.
Apply Logic To – select the general logic of redirecting rules:
Excepted URLs – choose the Specified URLs or All Except Specified URLs options above to define the excepted URLs here.
User Agents to Ignore – ignore redirection rules for specified search engines.
Restriction by IP – restrict redirection for certain IP addresses.
First Visit Redirect Only – activate to enable redirection only for the first visit.
Note: Beware that if you set this option to No, customers wouldn’t be able to switch store view and currency at their desire.
Redirect Between Websites – enable to redirect visitors between several websites.
Expand the Country to Store View Redirect section.
Enable Country –> Store View – enable to redirect visitors from certain countries to particular store views.
Switch the Store View dropdown menu to the required store version and define the list of countries that will be affected.
Now, visitors from the selected countries will see the defined store view version.
Open the Country to Currency Switch section.
Enable Country –> Currency – set this option to Yes to automatically switch currency according to the user's location.
Country to Currency Mapping – define country-currency relation by selecting countries and the appropriate currencies. Hit the Add button to create a new relation.
Then, proceed to the Country to URL Redirect section.
Enable Country –> URL – enable to redirect visitors from certain locations to any other URL.
Country to URL Mapping – select locations and specify the URL that would be used to redirect visitors to. Use the Add button to create a new country – URL relation.
Note: If you enable the Use Website checkboxes for the mapping options, the same set of rules would be applied to the Main Website and the selected Store View.
Login and Registration Form