Skip to content

Magento 2 Geo Lock Manual

Geo Lock Cover

Introduction

Out of the box Magento doesn't provide any possibility to allow/block the website for specific IPs or countries. It is supposed to be done by means of htaccess. To set it up correcly please check our special guide.

Magento 2 Geo Lock extension makes it possible to identify your shoppers' location and allow/deny them access to your store.

By means of this extension it is possible to:

  • Prevent any fraudulent store activities by blacklisting the IPs.

  • Manually specify countries to allow/deny accessing your site content.

  • Shape black/white IP lists.

  • Display 403 Access Denied text for users from the denied locations/ blacklisted IPs.

Requirements and Installation

Geo Lock 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.

Geo Lock has 3 separate ways of installation:

1) Copy the code (ready-to-paste package);
2) Use MageWorx Repository;
3) Use local Composer.

Extension Configuration

Magento 2 Geo Lock Settings

To observe the extensions settings, go to STORES ⟶ Configuration ⟶ MAGEWORX ⟶ GeoIP Extensions.

Magento 2 Geo Lock Settings

All the extension configurations are provided under the Geo Lock tab.

They can be logically divided into 3 parts.

GeoIP Database

The GeoIP extension is used to determine a country of your visitors and allow or forbid the access to your store. This module uses free MaxMind GeoIP database.

product reviews magento 2

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.

Enable the extension

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.

Allow/block By Country

Magento 2 Geo Lock by Country

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.

Whitelist/Blacklist IPs

Magento 2 Geo Lock by IP

Both White List and the Black List can be filled here. The wildcard symbol * can be used for IP arrays.

Special Cases

  1. 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).

  2. If the same IP is in the white list and the black list, then it will be allowed as the whitelist has higher priority.

  3. 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.

Magento 2 Geo Lock by IP

Nevertheless, the admin page will still be accessible so it can be removed without any problems.

Got Questions?

Mageworx offers FREE lifetime support and updates for any extension developed for Magento. 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.