Magento 2 GeoIP is a useful extension which detects the customers’ location based on their IP addresses, and automatically redirect the customer to the relevant store view as per their country.
The GeoIP extension basically help out the customer by making a personalized user experience for them, by switching the relevant store view and currency as soon as they visit the website from a different location.
After detecting their IP address as configured by the admin of the respective website.
This is a must to have a feature to assist store owners to bring a better experience for customers during their shopping journey.
- Geocode and Reverse Geolocation services are used in our module. To have these services you must have the Google API Key to make use of this extension. You can generate one by clicking here
- You need to enable billing for your google account project under which the API Key is created. For more information please visit here
- This module uses http://ipinfo.io/ third party services to trace user location from IP Address. If the API hit request on the website exceeds the allowed limit then the customer will be required to purchase the API key
Watch the below video tutorial to understand the extension workflow:
- Enhance user experience on shopping sites by allowing customers to purchase from their relevant store views.
- Auto-detect visitor’s location via IP address.
- Automatically redirect users to the relevant store view.
- Allow/Restrict customers to switch store views.
- Allow blocking customers by their countries IPs
- Redirect customers to a specific URL on viewing some restricted Product, Categories or URL.
- The admin can add a global restriction URL at which the customers will redirect, if store view is not mapped with any of the country.
- Switch the store view & currency based on the visitor’s location.
Installation Of GeoIP Extension
Customers will get a zip folder and they have to extract the contents of this zip folder on their system. The extracted folder has an src folder, inside the src folder you have the app folder.
You need to transfer this app folder into the Magento2 root directory on the server as shown below.
After the successful installation, you have to run these commands in the Magento2 root directory:
First command –
|1||php bin/magento setup:upgrade|
Second Command –
|1||php bin/magento setup:di:compile|
Third Command –
|1||php bin/magento setup:static-content:deploy|
After running the commands, you have to flush the cache from Magento admin panel by navigating through System > Cache management as shown below.
Configuration For Multi-lingual Support
For the multilingual support, admin will navigate through Store > Configuration > General > Locale Options and select the locale as German (the language into which admin want to translate his store content).
GeoIP Extension – Translation
If a user wants to translate their module from English to German then they need to follow the path app/code/Webkul/Geoip/i18n in their unzipped folder and will get a CSV file with name “en_US.csv”.
Now they will rename that CSV as “de_DE.csv” and translate all right side content after the comma in the German language.
After editing the CSV, save it and then upload it to the path app/code/Webkul/Geoip/i18n where they have installed Magento2 on the server.
The module will get translated into the German Language. It supports both RTL and LTR languages.
Initial Admin Configuration – GeoIP Extension
After the successful extension installation, The admin navigates through Stores > Configuration > GeoIP > GeoIp Settings for configuring the extension.
The admin needs to make some changes in the general settings of the extension to set it up.
- Enable:- The admin can Enable or Disable the extension.
- Google API Key:- Enter Google API Key here as the Google API is used in the module for the geolocation.
Note: For Google API Key, Please Visit https://developers.google.com/maps/documentation/embed/get-api-key
- Location Change:- Allow or Restrict customers to change their store view from the Location Change option.
- Currency change:- Allow or Restrict customers to change their currency from the Currency Change option.
Redirect Users to Relevant Store View based on their IP address
After the configuration, if the admin has allowed the customers to change their store views and currency as per the Location Change & Currency Change option.
Thereafter, by the help of GeoIP extension, the website will identify the customer location first and show the relevant store view and currency to them.
For example, U.S.A customers with U.S IP address are redirected to U.S store view only when navigating to your website.
But as the admin has allowed the Location change and currency change and configured the country-specific IP address, then in such case the U.S customers can also view the other store views available on the website.
Now the customer select the German store view and its relevant currency from the currency option.
If Location & Currency Change Are Restricted
If location & currency change is restricted by the admin, in such case, For Example:- the user of the U.S can view only the store view available for the U.S and the relevant currency only.
Global IP Redirection
Redirection URL:- The admin can set a Redirection URL at which the customers gets redirected to a specific URL, in case, if their countries IP is not configured by the admin.
For instance as shown below.
GeoIP Extension Management
From here the admin after configuring the extension will manage the GeoIP extension.
Geo Ip Store View Details
Now the admin will navigate to the store redirect sub-menu to map the store views with countries.
The admin can view the list of all the website store views which are mapped accordingly with the specific countries.
With the help of an action option, the admin can easily delete a specific or multiple store redirects at a time. Also by clicking on the “Add New” option, the admin can create a new mapping.
- Now for adding or mapping a new store, the admin will firstly enable the status.
- Enter the name of the redirect store.
- Select the countries whom IPs’ will be enabled for this store view.
- Select the store view and click on the save button.
After mapping the countries with store views, now the admin will map the currency with specific countries so that on visiting the store, the customer can see their desired currency option for making payment.
The admin will navigate to the GeoIP > Currency sub-menu option. As shown below in the snapshot.
The admin can view the list of all the currency mapped accordingly with the specific countries.
From here, the admin can delete the added currencies as well as can add new one as per the desired store view.
For mapping a currency with multiple countries, the admin clicks on “Add New” button.
- The admin will firstly enable the status
- Select the currency & finally select specific or multiple countries and save it
- The customers of these countries can select the currency on the website while shopping.
Here the admin restricts the customers based on their Country & state IP addresses’ to view the products, categories & URLs.
The admin can view all the created redirection on the basis of product, URL & categories type.
Admin can create a new redirection on either product, URL or category as per the selected countries by clicking on Add new button.
- The admin from here can enable the status of redirect feature.
- Selects the type i.e product, category or URL which must be restricted from the customer.
- After that, select product or category or enter URL as per the type selected in the above field.
- Enter the redirect URL where the customer reaches after trying to access the product, category or URL.
- In addition, the admin selects the countries & its relevant states whom customers are restricted to access the types selected.
Under this option, the admin can enter multiple IPs’, to block or blacklist customers
The admin from here can view the list of blocked countries IPs & can also add the new one by clicking on the “Add New” button.
- The admin needs to enable the status of the feature.
- Can enter multiple countries IP addresses to block.
- Enter the redirect URL at which the customer gets redirected to when belongs to the entered Ip addresses’.
In conclusion, that’s all for the Magento 2 GeoIP Extension. Still, have any issues please feel free to add a ticket and let us know your views to make the extension better http://webkul.uvdesk.com/.
Current Product Version - 4.0.0
Supported Framework Version - Magento 2.0.x, 2.1.x, 2.2.x,2.3.x, 2.4.x