Installation
Before installing the extension, please make sure to Backup your web directory and store database
To use this extension, you will require to install MageDelight Base Extension first. If it is not installed then please download it from https://www.magedelight.com/extensions/magedelight-base-extension.zip and unzip the package file into the root folder of your Magento 2 installation.
- Flush store cache
- Unzip the extension package file into the root folder of your Magento 2 installation.
- Connect to SSH console of your server:
- Navigate to the root folder of your Magento 2 setup
Run command as per below sequence,
php -f bin/magento setup:upgrade
php -f bin/magento module:enable Magedelight_GeoIp
php -f bin/magento setup:static-content:deploy
- log out from the backend and log in again
Backend Configuration (Admin side)
General
- Enable Module: You can enable or disable the module here. Select Yes to enable the module
- First Visit Redirect Only – If set to yes, admin can provide option to customers to switch the currency and store view. For eg. By default it will open website of USA if user is opening store from USA. But with this option user will have the option to select the store view of other countries.
- Change Default Tax Country – Automatically change default tax country by setting this field value to “Yes”. Location of the user will be detected automatically and tax would be applied as per the current location of the user.
- Change Default Country - Automatically change default country by setting this field value to “Yes”. Location of the user will be detected automatically and location would be set as per the current location of the user.
- Restriction Logic: You can select the logic from which pages your customers should be redirected
- User Agents to Ignore: Avoid unwanted store switching for user agents and search engine spiders. You can specify which of them to ignore.
- Ignore IP: You can add list of IPs to let them bypass the redirection rules set.
- Restrict IP: Ban user from accessing your site. You can add list of IPs of unwanted customers from accessing the site content. Those customers will be redirect to 404 not found page.
- Country Lookup Settings:
There are two lookup MethodsAPI: When you choose API you will see a list of lookup service provider option below. You can select the service you like to get the country location based on IP.
Please look into no of request provided by the API by visiting the official site of providers.
Database: In database Option we use MaxMind Country IP Database for GeoIP Information. MaxMind is very reliable and updates its database every month.
Make sure you have imported the database before selecting this option. Click here to check import instructions.
Log Settings: If you enable yes to this setting you will get all IP redirection information in - var/log/md_iplog.log
Backend Functionality
Importing Country List
The process may take around 10 to 20 minutes. Do not close or do any other process in any tabs till the process is completed. If there are any previous imported data, it will be replaced with the new one.
When you use lookup method as database. You need first to import GeoIp Information to your database.
We use MaxMind Country IP Database for GeoIP Information. MaxMind is very reliable and updates its database every month. You can download both IPV4 and IPV6 file from here.
You can download the latest database from below URL https://dev.maxmind.com/geoip/geoip2/geolite2/
Download CSV format ZIP file and upload it to the /var/ inside Magento (Highlighted in above screenshot).
Import Using Magento CLI: You can also start import process using Magneto CLI
Run command to get list of commands in magento CLI
php bin/magento list
Run command to start import process from CLI
php bin/magento magedelight:geoip:importcl -f {NAME OF THE UPLOADED ZIP FILE} -t ipv4/ipv6 - To import only IPV4 or IPV6
php bin/magento magedelight:geoip:importcl -f {NAME OF THE UPLOADED ZIP FILE} - To import both range of IP address
Manage Country Mapping
When you select Manage Country Mapping from GeoIp Menu You will see the list of country and their redirection place defined by you.
You can add new mapping by clicking Add New Mapping button.
- Countries: You can multi-select the countries you want to redirect.
- Redirect in: There are two options in here.
Stores: If you select stores option you will be see list of stores in your Magento instance below. Select the store you want to redirect in.
External Link: If you want to redirect to external link. Select this option. You will see a text box below; you can enter the URL you want to redirect in.
Manage Currency Mapping
As similar to Country Mapping you can manage Currency Mapping in same way. You will see the list of Country and their Currency defined by you.
You can add new mapping by clicking Add New Mapping button.
- Countries: You can multi-select the countries you want to redirect currency for.
- Currency: Select the currency you want for the following country.
Frontend Functionality
- Allow selected IP addresses of a blocked region to access the same blocked regions' store: If users IP address is blocked then they will not able to explore store and above page will be displayed
- Display country specific currency: It will set country specific currency automatically as shown in above image.
Thank you for choosing MageDelight!