• Migrating from Magento 1 to Magento 2 in 5 Simple Steps

    Migrate Magento 1 to Magento 2

    With over 5, 24,000 merchants using Magento worldwide, it continues to be the top-rated eCommerce platform. We discussed the compelling features and advantages of its latest version – Magento 2, at length, in a previous post Migrating from Magento 1 to Magento 2: Why It is Inevitable for Retailers. Now we will go a step further, presenting a step-by-step guide on how to migrate data from Magento 1 to Magento 2.

    Magento 2 was released in November 2015 and has a completely different architecture than Magento 1.

    Magento 2 supports full page cache by default. It’s much faster than Magento 1 and supports PHP 7. It has a user-friendly checkout, improved indexers and brings with it database optimizations.

    However, data migration may seem to be a nightmare to many in Magento development. This guide will help you get there in 5 simple steps. But before we jump into it, it’s important to understand that this migration will soon be compulsory for everyone.

    Why Migrate to Magento 2

    • Magento has stopped rolling out any new features in the Magento 1.x versions now, except for the security updates.
    • Magento team is likely to stop the official support for the Magento 1.x versions and stop releasing new security updates.
    • All the customizations you will be doing on your Magento 1.x version will have to be repeated in the Magento 2.x version, whenever you decide to migrate.

    Understanding the Magento 2 Migration Process

    There are four stages you need to go through in order to migrate your website from Magento 1 to Magento 2:

    • Data Migration
    • Extension Migration
    • Customizations Migration
    • Theme Migration

    In this technical note, I am going to explain the procedure of data migration using the data migration tool.

    Magento has released a data migration tool that helps developers migrate data from a Magento 1.x version to a Magento 2.x version. It is a command line interface that provides tracking, logging, verification, progress and testing functions.

    Steps to Migrate from Magento 1 to 2

    Step1: Setup Magento 2 Instance

    Download Magento 2 from https://www.magentocommerce.com/download without the sample data. Extract the downloaded data and follow the setup wizard to install the platform. Now, you have Magento 2 setup with an empty database. The data will be migrated in the database of this Magento 2 instance.

    Step 2: Download the Data Migration Tool

    Open the command line in the root folder of Magento 2. Download the data migration tool in the newly setup Magento 2, by following the command:

    composer require Magento/data-migration-tool:<version>

    The version of the data migration tool must match the version of the Magento 2 codebase. The version of Magento 2 can be found in the composer.json file present in the root of the Magento 2 directory.

    For example, for Magento version 2.1.0 the command would be:

    composer require Magento/data-migration-tool:2.1.0

    You will be prompted for the public key and your private key for authentication.

    Magento Migration

    To get these key values, login to your account in www.magentocommerce.com. After you log in, click on “My Accounts”. Now, click on the developer’s link in the left menu and then click on security keys. Here, you can find your keys.

    Magento 2 Data Migration

    After filling these details, a new folder named data migration tool will be created in <magento 2 dir>/vendor/magento/. You can download the data migration tool from githib also: https://github.com/magento/data-migration-tool.

    Step 3: Configuring the Data Migration Tool

    After downloading the data migration tool you will need to set the configuration for it. Under the data-migration-tool/etc folder you can see 3 folders: ce-to-ce, ce-to-ee, ee-to-ee.

    The folder ce-to-ce includes configuration files and scripts for migrating data from Magento 1 CE to Magento 2 CE. Folder ce-to-ee includes configuration files and scripts for migrating data from Magento 1 CE to Magento 2 EE. Folder ee-to-ee includes configuration files and scripts for migrating data from Magento 1 EE to Magento 2 EE.

    Enter the directory for which you are performing the migration (for example: ce-to-ce in the case of migrating data from community edition to community edition). Now enter the directory with the Magento 1 version name. For instance, if you are doing migration for Magento version then the you should enter the folder

    Make a copy of the file map.xml.dist and rename it map.xml, in this folder. (Use of this file explained in the migration step.)

    Make a copy of the file config.xml.dist and rename it config.xml, in this folder. Open this file and do the following changes in it:


    <database host=”magento1host” name=”magento1databasename” user=”magento1databaseusername” password=”magento1password” />



    <database host=”magento2host” name=”magento2databasename” user=”magento2databaseusername” password=”magento2password” />







    Required Values:

    Under source enter the Magento 1 database details, and in the destination enter the Magento 2 database details.

    Crypt_key value can be found in local.xml file which is located in the Magento 1 instance directory at: app/etc/local.xml in <key> tag.

    Optional Values:

    If you don’t have a prefix set for the  Magento 1 and Magento 2 tables, then you can leave the “1” source prefix, and “2” source prefix fields empty.

    Database mapping between your Magento 1 and Magento 2 databases is performed through mapping files which are located in: <Magento2      dir>/vendor/Magento/data-migration-tool/etc/<ce version>

    These files are used for changing the table names, field names, ignoring tables and fields and transferring data of a field to the Magento 2 format. We need to remove the .dist extension of these files to make use of these mappings.

    After removing the .dist from file names we need to change these file names (removing the .dist) in the config.xml file under the options tab.  Here you can see the location of the files that needs to be renamed.

















    This should now look like this:

















    Step 4: Provide the Prerequisites     

    Before you start your migration, you must do all of the following:

    • You need to stop all the current activities in Magento 1.
    • Stop all the cron jobs running on Magento 1 version and put the site on maintenance mode. The purpose of this is to stop all the activities that make any changes in the database. We need to make sure that there is no activity in the database once the data migration process starts.
    • Open ports in your firewall so that the migration tool can communicate with databases, and the databases of Magento 1 and Magento 2 can communicate with each other.
    • Migrate your theme to the Magento 2 theme structure.
    • Migrate all your Magento 1 customizations and extensions to Magento 2.

    In the event of unexpected issues that might cause redundancy, we advise you to make a backup of your Magento 1.x database.

     Step 5: Migrate the Websites

    Now we will migrate the websites, stores and system configuration like tax settings, payments, shipping etc…  For this we need to run the following command in the Magento 2 instance:

    bin/magento migrate:settings [-r|–reset] {<path to config.xml>}

    [-r|–reset] is an optional argument that starts the migration from the beginning.

    {<path to config.xml>} is the absolute path to config.xml file and is a required field

    The command should be:

    sudo bin/magento migrate:settings /var/www/magento2/vendor/magento/data-migration-tool/etc/ce-to-ce/

    Once it is done you will see the migration complete status.

    Upgrade Magento 1.9 to 2.0

    Next, you will need to run the data migration command:

    bin/magento migrate:data [-r|–reset] {<path to config.xml>}

    The command should be:

    sudo bin/magento migrate:data /var/www/magento2/vendor/magento/data-migration-tool/etc/ce-to-ce/

    This command checks the consistency of tables and fields between Magento 1 and Magento 2. If any problem is found then an error message will appear with a         list of all tables and fields that are not mapped.

    For example: if you extension tables error, and the custom field that I created in one of the tables. So, I got the following error.

    Magento Data Migration Tool

    To fix this problem you need to install the Magento 2 version of the extensions in the Magento 2 instance so that the missing tables are in the Magento 2 instance database as well.

    You can also ignore the tables and fields by adding their entries in map.xml file







    After making the entries, the corresponding tables and fields will be ignored and will not be migrated to the Magento 2 database.

    Run the migration command again to verify that the issues are fixed.

    The data migration is completed once you get the migration complete message.

    Magento 2 Data Migration Tool

    After migration is completed, if there are any new changes in the database, such as new orders are placed, or new reviews are added, then you can migrate that data by executing the following command:

    bin/magento migrate:delta [-r|–reset] {<path to config.xml>}

    The command should be:

    sudo bin/magento migrate:delta /var/www/magento2/vendor/magento/data-migration-tool/etc/ce-to-ce/

    This command can be stopped by pressing ctrl + C, or else it will keep on running.

    Upgrade to Magento 2

    Now your database is successfully migrated to Magento 2.

    Flush your Magento 2 cache, and re-index all Magento 2 re-indexers, then thoroughly test your new Magento 2 site.

    After the migration, you need to copy the media files from Magento 1 to Magento 2.

    Brace yourself for the following challenges during migration:

    Homepage not appearing correctly:

    If your Magento 1 version has a custom layout set for the home page, then in Magento 2 after migration, the home page will not appear correctly.  You either need to create a custom layout in Magento 2, or you can go to the Magento 2 admin panel and change the layout in pages for your home page.

    Products not appearing in category:

    You need to re-index all the indexers. In Magento 2 you need to go through the command line as it can’t be done from admin panel like in Magento 1.

    CSS js files not loading:

    For this, you need to flush your cache and then deploy the static content.

    (If you are still facing a problem after removing the cache, then manually remove all the subfolders from the cache folder.)

    Summing up

    Migrating from Magento 1 to 2 will soon be a necessity for eCommerce players; it promises a number of benefits. Amid the cutthroat competition in the retail industry, business owners need to be on their toes and constantly striving to offer more enticing ways to deliver a compelling customer experience. Magento migration is a significant step in that direction.

    If you are looking for any further assistance on migrating from Magento 1 to 2 or create digital solutions for better customer or employee engagement, we can help. Please contact us at info@netsolutions.com.

    Magento 1 to Magento 2 Migration

    Surabhi Shukla

    About the Author

    Surabhi is a proficient PHP developer and has worked on frameworks and CMS like Joomla, CakePHP, Drupal, and Magento. She is also a Magento certified developer and Developer Plus. When not at work, she relaxes by listening to music and is an avid reader.



    get in touch

    Ready to discuss your requirements?

    Request Free Consultation


    Stay updated on the most effective technologies and trends that will shape up tomorrow's digital experiences.