Magento – Magento 2: How to we migration only customers and orders data using Data Migration tool

magento-2.1magento2-migration-tool

In my current Magento 2 instance I have added products and categories manually as well as all the settings.

Is it possible to migrate only orders and customers data from my old site using Data Migration tool?

Best Answer

Yes, it is possible but you will have to modify a bit the config files to get what you need.

Here is an example of the Data Migration Tool config.xml used to migrate only customers and newsletters subscribers.

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="../../config.xsd">
<steps mode="data">
    <step title="Data Integrity Step">
        <integrity>Migration\Step\DataIntegrity\Integrity</integrity>
    </step>
    <step title="Customer Attributes Step">
        <integrity>Migration\Step\Customer\Integrity</integrity>
        <data>Migration\Step\Customer\Data</data>
        <volume>Migration\Step\Customer\Volume</volume>
    </step>
    <step title="Newsletter Subscribers Step">
        <integrity>Migration\Step\Newsletter\Integrity</integrity>
        <data>Migration\Step\Newsletter\Data</data>
        <volume>Migration\Step\Newsletter\Volume</volume>
    </step>
</steps>
<steps mode="delta">
    <step title="Customer Attributes Step">
        <delta>Migration\Step\Customer\Delta</delta>
        <volume>Migration\Step\Customer\Volume</volume>
    </step>
</steps>
<source>
    <database host="172.x.x.x" name="source-db-name" user="dbuser" password="dbpassword"/>
</source>
<destination>
    <database host="172.x.x.x" name="source-db-name" user="dbuser" password="dbpassword"/>
</destination>
<options>
    <map_file>etc/ce-to-ee/1.7.0.0/map.xml</map_file>
    <customer_map_file>etc/ce-to-ee/map-customer.xml</customer_map_file>
    <customer_document_groups_file>etc/ce-to-ee/customer-document-groups.xml.dist</customer_document_groups_file>
    <customer_attribute_groups_file>etc/ce-to-ee/customer-attribute-groups.xml.dist</customer_attribute_groups_file>
    <delta_document_groups_file>etc/ce-to-ee/deltalog.xml</delta_document_groups_file>
    <map_document_groups>etc/ce-to-ee/map-document-groups.xml.dist</map_document_groups>
    <bulk_size>0</bulk_size>
    <direct_document_copy>0</direct_document_copy>
    <source_prefix />
    <dest_prefix />
    <auto_resolve_urlrewrite_duplicates>0</auto_resolve_urlrewrite_duplicates>
    <log_file>migration.log</log_file>
    <progress_bar_format>%percent%% [%bar%] Remaining Time: %remaining%</progress_bar_format>
    <upgrade_customer_password_hash>1</upgrade_customer_password_hash>
    <edition_migrate>ce-to-ee</edition_migrate>
    <edition_number>1.7.0.0</edition_number>
    <init_statements_source>SET NAMES utf8;</init_statements_source>
    <init_statements_destination>SET NAMES utf8;</init_statements_destination>
    <crypt_key>xxxxxxxxpatataxxxxxxxxxx</crypt_key>
</options>

In this example you can see how all unnecessary steps have been removed to leave only Customer Attributes Step which is in charge of customer migration.

Newsletter Subscribers Step is a custom step created to migrate specific data.

You can use this example to modify your config.xml file and migrate only customers and sales data.

Hope it helps.