Magento 2 Migration
Plan. Optimise. Grow.
Magento 2 Migration
Magento 2 Migration - The Ultimate Guide (Updated September 2020)
Magento 2 was released in July 2015 and since then it has been the talk of the town. Though it was new, raw, buggy and had some glitched still some merchants dared to migrate their existing stores. Magento 2 has a completely different architecture and lots of new & advanced features if compared with Magento 1. The majority of the customers have already been migrated their platform from Magento 1 to Magento 2 but there are still some who haven’t yet. But as Magento officially announced that the support for Magento will end in June 2020 or as long as licenses have been extended to align with that date.
If you have migrated from Magento 1 to Magento 2, well done. But, if you haven’t done so and are not even thinking of migrating, then you might suffer. As a consequence, security patches will not be produced for these versions once support ends and your competitive edge will be at risk, as no innovation or features will be added on Magento 1 because all the innovation that is needed to stay competitive is happening on Magento 2.
It means that any Magento eCommerce store which is not yet migrated M2 is prone to risk as it will be functioning on unsupported software. So, don’t wait for any more to take the next step!
The right time to Migrate to Magento 2 is NOW!
The migration process isn’t easy and is not just a transition from one version to another. Magento 2 is built on a totally different architecture. It includes a host of new features and functionalities that any Magento store shouldn’t miss.
Migrating from Magento 1 to Magento 2 would actually feel like developing a whole new website from scratch. All customizations done on version 1 would need to be reviewed, rewritten, and made compatible with Magento 2 and recent versions of PHP. Depending on your store size it would be better to start the migration at the earliest.
Make sure to back up your database and files before you attempt to migrate to Magento 2. There may be issues, and it is important to have a Plan B just in case. Create a clone of your Magento 1 store. Do not use the live store for the Magento migration process. Analyse the store. Keep what you consider necessary and delete the rest. Check the compatibility of current themes, extensions and custom code with Magento 2. Get rid of the outdated and useless data from the database such as logs, recently viewed products, etc.
Also, consider test-driving the migration process on a staging environment first. Make a copy of your website somewhere (on a different server preferably) and practice your update steps there.
Following are the major steps in the migration:
- Stock Magento 2 Installation
- Magento Data Migration
- Magento Theme Migration
- Magento Extension Migration
Before we begin the migration, check on your hardware and software requirements.
Magento 2 supports PHP 7, full-page cache by default, and is much faster than Magento 1. So, if you have PHP 5 or a lower version, Magento 2 will run poorly and would not support the outdated version of the software.
To ensure a smooth and fast performance make sure your server has the following programs installed:
- PHP: 7.0.13+ or 7.1.x
- MySQL: 5.6, 5.7 or MariaDB 10.0,10.1,10.2 or Percona 5.7
- The following PHP extensions: bc-math, ctype, curl, dom, gd, intl, mbstring, mcrypt, hash, openSSL, PDO/MySQL, SimpleXML, soap, spl, libxml, xsl, zip, json, iconv
- At least 2G of RAM minimum
- 24GB+ SSD (Solid State Drive)
- M2 won’t run well with less than 2G of RAM, and SSD technology will cause it to run much faster.
It is safe to follow the Official Magento Migration Documentation, according to which, the process is divided into four stages.
Step 1: Stock Magento 2 Installation
The migration process starts by installing a fresh copy of Magento 2 software. You can download the latest version of Magento 2 Open Source software from Magento official website. Select the format that you want and download the file.
Note: As of writing this article the latest version is Magento Open Source 2.3.4 (added on January 28, 2020).
Once the download is complete, install the software on a basic VPS (virtual private server) with at least 2GB of RAM and 24GB of SSD space.
When everything is ready, open up a browser and start the installation process. After that, you need to click to setup Magento 2. At this stage i.e. ‘readiness check’, you may see a few ‘red cross’ across a few extensions, this is against a few missing PHP extensions. You can install the missing extensions with the help of the following command:
apt-get install php7.1-curl php7.1-mcrypt php7.1-bcmath
Once it passes through all the check-points/stages in the process, the last one is to click the “install now” button.
After you’ve successfully installed Magento 2, we are ready to migrate from Magento 1 to the fresh Magento 2 store.
Step 2: Magento 2 Data Migration
Once the Magento 2 setup is done, the next step is to migrate data from your Magento 1 store. Migrate the data from the cloned database of the Magento 1 store and not from the original one. Magento 2 offers a tool to efficiently migrate data from Magento 1 to Magento 2, and it is called the ‘Data Migration tool’. With this tool, you can easily migrate data related to customers, products, orders, store settings, configurations, customer ratings, and reviews, etc. Before you go live, the Magento 1 site needs to be put under maintenance mode to prepare for the actual migration. System configuration like shipping and payments will also be migrated along with the final data migration. This will be the end of all administrative activities in Magento 1.
Before you start the tool installation, make sure that the version of the Magento 2 store and Data Migration Tool match. For example, if you are using Magento version 2.2.0, you must install the Data Migration Tool version 2.2.0.
Update the location of the Data Migration Tool package in the composer.json file to make it work. For that, run the below two commands:
composer config repositories.magento composer https://repo.magento.com
composer require magento/data-migration-tool:<version>
In the above command, <version> refers to the tool version that is the same as that of your Magento 2 version.
At this point, you will need to enter your developer authentication keys. To do so,
- Go to Magento Marketplace, log in to your developer account, navigate to your profile and click ‘Access Keys’ under the ‘My Products’ section.
- Enter the username, i.e., public key and password, i.e., private key.
- You may create new keys using the ‘Create a New Access Key’ button.
- That’s all for the installation of the Data Migration Tool in the Magento 2 store. The next step is to configure the ‘Data Migration tool’. Here’s how:
- Configure Data Migration Tool
- Go to the Magento 2 root folder and find the following directory:
This directory contains configuration and scripts for migrating from Magento 1 Open Source platform to Magento 2 Open Source platform.
Note: Substitute 22.214.171.124 with your site’s Magento 1 version and change ‘opensource-to-opensource’ to ‘opensource-to-commerce’ if you are migrating from the Community Edition to Enterprise Edition.
Before you migrate any settings and data, you must create a config.xml file in the relevant directory. For example, if you are performing data migration from Magento 1 Open Source platform to Magento 2 Open Source platform, navigate to the following directory
<Magento 2 root dir>/vendor/magento/data-migration-tool/etc/opensource-to-opensource/<Magento 1.x version>
config.xml.dist to config.xml.
Next, open config.xml in a code editor and specify the following credentials that includes; database name, database username and database password:
<source> <database host="localhost" name="Magento1-DB-name" user="DB-username" password="DB-password"/> </source> <destination> <database host="localhost" name="Magento2-DB-name" user="DB-username" password="DB-password"/> </destination> <options> <crypt_key>Magento1-Encrypted-Key</crypt_key> </options>
- <source> has the database information of Magento 1
- <destination> has the relevant database information of Magento 2
- <crypt_key> is mandatory and needs to be filled prior to run. It is the encryption key of Magento 1 store and can be found in the <Magento 1 root dir>/app/etc/local.xml file, within the <key>
Finally, save the config.xml.
Migrate Settings Using Magento 2 Data Migration Tool
Magento 2 Data Migration Tool settings include stores, system configurations such as shipping, payment, tax settings, etc.
According to the Magento Data Migration Order, you should migrate settings first. Navigate to your Magento 2 root directory via SSH terminal and run the following command:
php bin/magento migrate:settings --reset <path to your config.xml>
where <path to your config.xml> would be vendor/magento/data-migration-tool/etc/opensource-to-opensource/<Magento 1.x version>/config.xml.
Note: We have used – “reset” argument in the command above so that the ‘Data Migration Tool’ is forced to start from the beginning.
The success message is displayed once the settings are over.
Migrate Data Using Magento 2 Data Migration Tool
Data migration from Magento 1 to Magento 2 includes products, categories, orders, customers, wish lists, ratings, etc. To migrate data, run the following command:
php bin/magento migrate:data --reset <path to your config.xml>
The tool saves its current progress. If an error occurs, or if it stops the process for any reason, it resumes from the last known stage. The success message is displayed on the completion of data migration.
Migrating Media Files:
If you store all your media files in a database (which is a usual case in Magento 1), it will be automatically migrated to Magento 2 database just like other data. Just make sure you sync it before data migration. Here’s how you can do so:
Goto - Magento 1 backend menu > System > Configuration > Advanced > System
And then, click on the ‘Synchronize’ button.
Step 3: Magento Theme Migration
You can either go with your current Magento 1 store theme or go for a complete makeover. If the current design is compatible with Magento 2 and matches up with the functionalities, then the same will be applied or a new design needs to be custom made or purchased from Magento Marketplace. If you go with a readymade theme from the Magento store, it’ll save you a lot of time. Don’t forget to check the compatibility of the theme with the Magento 2 version.
And if you decide to port your existing theme to Magento 2 store, it might get a little tricky and will delay your migration. In most cases, it is better to hire a certified Magento 2 Developer for migration.
A few points you must be careful about:
- The XML structure of M2 is different than that of M1, so you cannot simply copy and paste the layout files.
- M2 replaces the prototype JS framework of M1 with jQuery.
- CMS syntax is similar, so you can make CMS pages work with a little effort.
- M2 features three running modes: default, developer, production. Use the developer mode to develop, and then production mode once the site goes live.
Step 4: Magento Extension Migration
You had installed numerous extensions on your Magento 1.x store for better functionality and various features. It is unlikely that they will work directly on your Magento 2 store. You may face severe compatibility issues with almost all extensions. It’s better to make a list of extensions you’d like to have on your new Magento 2 store. Then, you can either re-create the ones you need or an alternate option is to hire a certified Magento 2 developer to create these extensions for you.
Step 5: Testing
The most important step is to thoroughly test your newly created Magento 2 before going live! Check every bit and piece of your new Magento store in and out. Test everything that you can. Double-check each functionality, be it payment, wish list, order information or anything else. Make a list of ALL the features of your current Magento 1 and check them one by one. Test any complex shipping setups to make sure they work like they’re supposed to.
Magento 1 to Magento 2 migration is a complicated task and requires professional attention to every single detail. One small mistake in the migration can lead to data loss or improper store functioning. So, it is advisable to let a professional Magento development company or a certified Magento developer do the migration task.
Another important thing that you must consider is that Magento 1 to Magento 2 migration will have an impact on your SEO-targeted extensions. It is recommended that you sit with your SEO team and address each issue separately. Or, hire an expert SEO company who can create & change all the required settings and optimize SEO set up in accordance with Magento 2 structure.