In this article, you will learn how to upgrade the Magento 2 GeoIP Lookup extension from v1.x to v2.x using two methods – via FTP or Composer.
Important Information:
We strongly recommend upgrading and testing the GeoIP Lookup extension in a development environment before deploying it on the production shop.
The difference between GeoIP Lookup v1.x and v2.x is that in v1.x, the Maxmind and IpToCountry work is based on the Magento database, while in v2.x, this work is based on the mmdb files. Because of this, please follow the steps described below to make the integrations work properly.
Important Information:
If you already configured the Maxmind and IpToCountry integrations in your Magento, they will stop working after the extension upgrade, so you should perform additional configurations.
Step 1. Back Up your data
We strongly recommend that you back up all your Magento 2 files and folders before you proceed with updating the extension to ensure the whole process runs smoothly.
Step 2. Update the Extension
You can choose one of the two following methods to update the extension on your Magento 2 store:
Updating Extension via Composer
First, remove the following folders if they exist:
app/code/Plumrocket/GeoIPLookup
app/code/Plumrocket/Base
Then, update the extension files by running the following command from the Magento root directory:
- Use this command if the GeoIp Lookup v1 Extension was installed in the
vendor/plumrocket/module-geo-ip-lookup
folder.
composer update plumrocket/module-geo-ip-lookup
- Use this command if the GeoIp Lookup v1 Extension was installed in the
app/code/Plumrocket/GeoIPLookup
folder.
composer require plumrocket/module-geo-ip-lookup
After running the command, you may be prompted to enter the username and password. In order to find your personal Username and Password to update the extension via the Composer, go to your Plumrocket account > My Downloads, find the required Plumrocket extension in the list, and click the Install via Composer link.
Run the next four Magento 2 commands to complete the updating process:
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
Updating Extension via FTP
In order to update the extension files via FTP, remove the app/code/Plumrocket/GeoIPLookup
folder and perform the Installation via FTP steps.
Step 3. Import the Maxmind and IpToCountry databases
Our extension offers two options for the Maxmind and IpToCountry databases import: automatic and manual.
Important Information:
To reduce the site’s downtime during the push to your live site, we recommend swapping steps 2 and 3 of this documentation and performing the database manual import before the extension update.
Importing the databases automatically
To update the databases automatically, go to Plumrocket > GeoIP Lookup > Configuration > Maxmind GeoIP Database (IpToCountry GeoIP Database) and do the following:
Step-by-step guide:
- Change the “Installation Method” to “Automatic Installation“.
- Press the Install Database button.
Importing the databases manually
To install the databases manually, please follow our Databases Manual Installation developer’s guide.