Magento 2, the transformed version of the Magento Ecommerce Platform, comes with a brand new architecture, coding structure, and database design. The support for Magento 1 will end soon. Already the best minds in the ecommerce development industry are focused on making Magento 2 a successful ecommerce platform. In this context, the most important question is how to conduct Magento migration.
This is what Ben Marks, Evangelist at Magento, tweeted about the sunset of Magento 1:
Paul Boisvert, head of Product Management at Magento, also verified the information and said that November 18th, 2018 is the exact date when the world will bid Magento 1 an official goodbye with three years of End-of-Life (EOL) warning to store owners. But later this was said by Magento Inc. that right now they have no plan to discontinue the support for Magento 1.
Given all this, it is essential that store owners should start planning of Magento migration from M1 to M2 as soon as possible. If you are planning on moving over to Magento 2, continue reading this blog post because today, I am going to give you a detailed overview of the Magento migration process.
Before starting the actual migration process, consider the following recommendations:
- Make a full backup of your Magento 1 store including all files, folders, and the database.
- Create a clone of your Magento 1 store. Do not use the live store for Magento migration process.
- Analyze your store. Keep what you think is necessary and delete the rest.
- Check whether your current theme(s), extensions and custom code are compatible with the Magento 2.
- Migrate the data from the cloned database of your Magento 1 store.
- Remove outdated and useless data from the database. This includes logs, recently viewed products, compared products, etc.
- To make Magento migration process as hassle-free as possible, install a fresh copy of Magento 2 on the same hosting server where your Magento 1 store is located.
According to the official Magento documentation, migration to the Magento 2 consists of four different stages:
Magento 2 introduces new methodologies and technologies for delivering enhanced shopping and store experience to the merchants and users. Developers can take advantages of new ways of creating awesome Magento 2 themes or modify the current ones to make them compatible with the Magento 2 standards. You should keep in mind that you cannot directly migrate your Magento 1 theme to Magento 2.
You have to create a new theme for Magento 2 and make it responsive for the best user experience. To help you with this, I have written an easy-to-follow article on how to create a custom theme in Magento 2.
If you wish to avoid all this hassle, buy and install a Magento 2 theme from the Magento Marketplace or other reputed sources.
Extensions are essential components that provide new features and extend the functionalities of your Magento store. The next step in Magento migration process is to install the desired Magento 2 extensions available on Magento Marketplace.
Remember that, Magento 1 extensions will not work on Magento 2. You will experience severe compatibility issues while integrating Magento 1 extensions into Magento 2.
Only install the relevant extensions that are available and required for your Magento 2 stores. The Magento developers, community and development agencies are still working hard on porting Magento 1 extensions to Magento 2.
If you want to do it on your own, and want to learn more about Magento 2 extension development, please have a look at my how to create Magento 2 extension blog post.
In many cases, the custom code used by your Magento 1 store is compatible with Magento 2. Magento offers a Code Migration Toolkit that helps you in this process. It should be noted here that due to structural differences in the two platforms, This Magento migration may require additional work to make sure that the custom code successfully integrates with the Magento 2 store.
To know more about the integration, visit the GitHub repository of the Magento Code Migration Toolkit.
The last action you need to perform during Magento migration process is moving your Magento 1 settings and data to Magento 2. To ease up the Magento migration process, Magento has officially released Magento 2 Data Migration Tool that helps developers migrate their store data and settings using CLI commands. It makes the Magento migration process hassle-free and helps in migrating critical data (products, categories, orders, store configurations & settings, etc.) to Magento 2.
Data Migration Tool migrates the entire data from the database of Magento 1 platform to the database of Magento 2 platform based on a set of rules defined in the XML files. As of now, the Data Migration Tool only transfers data and settings. Extensions, themes, and other code customizations of Magento 1 store cannot be automatically migrated to Magento 2 store. You will have to reach out to your theme/extension provider to see if they have provided an exporting option yet for Magento 2 platform.
Install Magento 2 Data Migration Tool via Composer
You can install the Data Migration tool into a fresh Magento 2 store using Composer. Remember, it’s not a Magento 2 extension, it’s a standalone shell application that requires Magento 2 store to become operational.
To install the Data Migration Tool, make sure that the version of 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. In general, If you are using the latest version of Magento 2 platform, you have to use the most recent version of the Data Migration Tool as well.
To find the version of your store, navigate to the root directory of your Magento 2 via SSH and enter the following command:
php bin/magento --version
Now, once you know the version of your Magento 2 store, it’s the time to install the Magento 2 Data Migration Tool.
Keep in mind that you must update the location of the Data Migration Tool package in the composer.json file to make it work.
To do that, just run the following commands:
composer config repositories.magento composer https://repo.magento.com composer require magento/data-migration-tool:<version>
In the above CLI command, <version> refers to the version of the Data Migration Tool that must match the Magento 2 version discovered earlier.
For example, if you are using Magento version 2.2.0, enter:
composer config repositories.magento composer https://repo.magento.com composer require magento/data-migration-tool:2.2.0
You will be asked to enter your developer authentication keys. Go to the Magento Marketplace. Sign in using your login credentials, go to your profile and then click Access Keys under My Products section.
If you already have keys then, your public key will be your username and the private key will be your password. Otherwise, create a new key pair by clicking the Create a New Access Key button.
In a few seconds, the Data Migration Tool will be successfully installed on your Magento 2 store.
Configure Magento 2 Data Migration Tool
After the installation is finished, the following directories will contain mapping and configuration files for the Data Migration Tool.
<Magento 2 root dir>/vendor/magento/data-migration-tool/etc/opensource-to-opensource
The above file will contain configuration and scripts for migrating from Magento 1 Open Source platform to Magento 2 Open Source platform.
<Magento 2 root dir>/vendor/magento/data-migration-tool/etc/opensource-to-commerce
The above file will contain configuration and scripts for migrating from Magento 1 Open Source platform to Magento 2 Commerce.
<Magento 2 root dir>/vendor/magento/data-migration-tool/etc/commerce-to-commerce
The above file will contain configuration and scripts for migrating from Magento 1 Commerce to Magento 2 Commerce.
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
<Magento 2 root dir>/vendor/magento/data-migration-tool/etc/opensource-to-opensource/<Magento 1.x version> directory and rename config.xml.dist to config.xml.
Next, open config.xml in your favorite code editor and specify the following:
<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>
In the above code, <source> has the database information of Magento 1 and <destination> has the relevant database information of Magento 2. <crypt_key> is mandatory and needs to be filled prior 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> tag.
When finished, save the config.xml and you are done.
Migrate Settings Using Magento 2 Data Migration Tool
Here is how you can use the Data Migration Tool to migrate settings from Magento 1 to Magento 2. These settings include stores, websites, system configurations such as shipping, payment, tax settings, etc.
According to the Magento Data Migration Order, you should migrate settings first. To start migrating the settings, 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> this would be vendor/magento/data-migration-tool/etc/opensource-to-opensource/<Magento 1.x version>/config.xml. I have used –reset argument in the above command which forces the Data Migration Tool to start from the beginning.
Once the settings migration is over, a successful message will be displayed.
Migrate Data Using Magento 2 Data Migration Tool
Data migration from Magento 1 platform to Magento 2 platform includes products, categories, orders, customers, wish lists, ratings, etc. To migrate data, run the following CLI command:
php bin/magento migrate:data --reset <path to your config.xml>
As this command runs, the Magento 2 Data Migration Tool saves its current progress, and in the case of an error, stop the process and resume from the last known good state. Also, the Magento 2 Data Migration Tool may report some errors during the migration. In such a case, refer to the Troubleshooting page of the Magento 2 Data Migration Tool for further assistance.
Once the data migration is complete, you will receive a success message.
Once all Magento migration processes are successfully over, do not forget to test the Magento 2 store thoroughly to ensure that everything functions properly. Although I have outlined the entire migration process, it is not an easy task since it is not fully automated yet. You will have to do plenty of manual work to answer the question: how to do Magento 1 to Magento 2 migration.
For smooth and trouble-free Magento migration you can choose Cloudways Magento hosting, I would recommend store owners hire a Magento professional for the job. In case, you face a difficulty in understanding the migration process, leave your questions in the comments section.