Welcome! Today we’ll show you how to migrate your store data from Magento 1 to Magento 2 using Magento 2 data migration tool. You’ll also learn how you can manage themes, extensions and customization. Together we’ll follow the next script:

Let’s get the ball rolling!

Magento 2 Usage Statistics

Magento 1 stops official updates in November 2018. According to BuiltWith, the number of live websites using Magento 2 grew up to 13500 at the moment (July 2017). There were 11000 live websites in May 2017. As you can see, Magento 2 becomes more and more popular, while the first version still exists. If you’ve made a decision to move to Magento 2, there is a complete guide on how to do this. But this task requires strong web development skills, some effort and a bit of patience:)

Migration to Magento 2 process

While migrating your website from Magento 1 to Magento 2, you’ll work with four components:

  • data;
  • themes,
  • extensions and custom code;
  • customization.

Each of these components requires a certain approach.

Data. Magento 2 Data Migration Tool is a ready-made assistant for migrating the website data. We can move all our customers, products, store configurations, order and promotions data to Magento 2 with its help. It is the process we’ll focus on in our article.

Themes and customization. As for themes, we’ll need to make changes to themes and customizations for Magento 2. The system’s hierarchy is completely different from Magento 1. So, you’ll find lots of space for your creativity and innovation.

Extensions and custom code. We can go to Magento Marketplace or MagentoConnect and get new Magento 2 extensions with their latest versions. Also, we can develop a new custom solution. If you want to migrate the custom code, you can use Code Migration Toolkit presented by Magento on Github.

According to Magento community, migration to Magento 2 is 20% more complicated than updating Magento to the latest minor version. Opinions differ. It depends on the level of developer’s experience and the project complexity.

Our today’s task is to migrate data with Magento 2 Data Migration Tool. Follow our step-by-step guide below, and you’ll make it!

Migrating Data with Magento 2 Data Migration Tool

Before we start, we should make several preparation steps. Let’s run through them.


  • Check system requirements. Check parameter in php.ini

memory_limit: more than 512M

  • Install Data Migration Tool. Versions of Magento and Data Migration Tool must match.

How to Install Data Migration Tool

First, you need to edit composer.json in Magento root directory. This way you provide the location of the Data Migration Tool package: “url”: “https://repo.magento.com/“. Also add to require “magento/data-migration-tool”: “version”, where “version” must match the Magento 2 code base version.

  • Create Magento 2 database backup. This will allow you to restore the initial database state if migration is not successful.
  • Check the network access to connect Magento 1 and Magento 2 databases.
  • Copy Magento 1.x media files to Magento 2.x. You need to copy them manually from magento1-root/media to magento2-root/pub/media directory.
  • Stop all Magento 1.x cron operations.
  • Stop making any changes in Magento 1.x Admin except for order management and in Magento 2 Admin and storefront.
  • Remove outdated and redundant data from Magento 1.x database (logs, order quotes, recently viewed or compared products, visitors, event-specific categories, promotional rules, etc.).

Configuring Migration to Magento 2

If we need to migrate Magento 1.x EE to Magento 2.x EE, the mapping and configuration files will be located in the following directory:

 <your Magento 2 install dir>/vendor/magento/data-migration-tool/etc/ee-to-ee

Create a config.xml from the provided sample config.xml.dist .

If we migrate data from Magento, the config.xml and map.xml. will be located in the following directory:

<your Magento 2 install dir>/vendor/magento/data-migration-tool/etc/ee-to-ee/

But before, enable to perform custom database mapping between your Magento 1 and Magento 2 databases.

Specify the access to the databases in config.xml:

    <database host="" name="magento1" user="root"/>
    <database host="" name="magento2" user="root"/>
    <crypt_key />

The <crypt_key> tag must be filled in. You can find it in local.xml file. The file is located in Magento 1 instance directory at app/etc/local.xml in <key> tag.

Migration to Magento 2 Modes

Overall, migration from Magento 1 to Magento 2 consists of three phases (modes):

  • Settings: migrates configuration settings.
  • Data: bulk migrates main data to the database.
  • Delta: transfers incremental data updates added to Magento 1 storefront and Admin Panel while running previous migration modes.

Each mode is declared in config.xml and divided into steps. Each step is responsible for transferring particular data. At the begin of the run, the step checks Magento 1 and Magento 2 table structures for consistency. Then the actual data is transferred to Magento 2. At the end, this data is verified.

If you don’t want to migrate some data from Magento 1 to Magento 2, you just need to disable or remove the specific step in config.xml. For example, remove the following step from Data mode:

<step title="Log Step">

And remove this one from delta mode:

<step title="Log Step">

Furthermore, if we do not want to track the changes in the log_visitor table, we need to remove “delta_log” group in deltalog.xml.dist file:

<group name="delta_log">
   <document key="visitor_id">log_visitor</document>

Migrating Settings and Data to Magento 2

So, we successfully moved to the finish.

To start migrating settings, run:

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


  • [-r|–reset] is an optional argument that starts the migration from the beginning. You can use this argument for testing migration.
  • {<path to config.xml>} is the absolute file system path to config.xml.
  • [ -vvv] – you can use this argument to output more verbose messages in the console.
<your Magento 2 install dir>/vendor/magento/data-migration-tool/etc/ee-to-ee/

To start migrating data, run:

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

To start migrating incremental changes, run:

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

Incremental migration enables to migrate only data that customers added via storefront (created orders, reviews, changes in customer profiles, etc.) and all operations with orders in Magento Admin panel.

Incremental migration runs continuously until you stop it by pressing CTRL+C.

Reindex all Magento 2.x indexers after migration.

Possible Problems

We can get the following error during Data Integrity Step:

  • Error: Foreign key (<KEY_NAME>) constraint fails. Orphan records id:<id> from <child_table>.<field_id> has no referenced records in <parent_table>

Solution: There are missing database records in the parent_table. The field_id of the child_table is pointing to this parent_table.

If we can not delete the records from the child_table, we can just disable Data Integrity Step in config.xml:

<step title="Data Integrity Step">

The data migration tool recognises the differences in database structure between Magento 1.x versions. Most of these database structural differences are declared in map files. Each step in the process uses map files to transform data for use in the Magento 2 store. When differences are not declared in map files, then the Data Migration Tool displays an error and does not run.

If some Magento 1 entities (in most cases, coming from extensions) do not exist in Magento 2 database, the following errors may occur:

  • Error: Source documents are not mapped: <EXTENSION_TABLE>

Solution: Install the corresponding Magento 2 extensions or ignore the problematic data in map.xml (or map.xml.dist).

  • Error: Source fields are not mapped. Document: <EXTENSION_TABLE>. Fields: <EXTENSION_FIELD>


  • Error: Destination documents are not mapped: <EXTENSION_TABLE>


  • Error: Mysql server has gone away

Solution: Increase the following value in the /etc/mysql/my.cnfmysql configuration file:

  • max_allowed_packet = 2000M
  • wait_timeout = 6000

That’s it. We did it! How are you? Have you done? If yes, congratulations with the successful migration from Magento 1 to Magento 2. In case some issues arose over the process, we’ll gladly help you to sort them out. Send us the request through the Ask Questions form below, and together we’ll find the solution.

We are happy to be useful for you. If you have any topics in mind you are interested to discover, you can contact us and share your ideas.

Have a nice day and let your migrations be successful![/vc_column_text][/vc_column][/vc_row]