6

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?

3
  • Migrate Sales and Customers data done or not? Apr 5, 2018 at 12:34
  • No it wasn’t worked earlier. So I have to do some manual work Apr 11, 2018 at 11:32
  • @HitarthPattani, yes it's possible, but if you have already imported products and categories, migration tool will work with only fresh database, hope you may get errors Sep 27, 2019 at 7:09

2 Answers 2

1

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.

7
  • Hello @diazwatson, I have tried to migrate data using delta migration, but seems like the we have to use the same database that we have used for first data migration. Am I Correct? I need to migrate customers and sales data only from scratch. Can we do that using delta migration? Jul 24, 2017 at 13:08
  • 1
    Hi, That is correct!, You have to use the same database you used for first data migration because it is in data step where the tool creates what it needs for delta step to work.
    – diazwatson
    Jul 24, 2017 at 13:49
  • @hitarth-pattani I just remembered a similar question I answered, related to delta step. It may help you achieve what you want to do. magento.stackexchange.com/questions/132744/…
    – diazwatson
    Jul 24, 2017 at 23:59
  • Hello @diazwatson, Yes I do know that this delta migration requires m2_cl_* tables which was created at the first time of data migration. but my requirement is to migrate only customer and sales from M1. Do you have any reference for this? Or if you can guide me on that which helps a lot. Jul 25, 2017 at 7:22
  • Have you read my answer?, I think I already gave you a good example of what you need to do to achieve what you want :)
    – diazwatson
    Jul 25, 2017 at 7:53
0

Firstly Follow http://devdocs.magento.com/guides/v2.2/migration/migration-migrate-data.html

Difficulty: You only need to migrate customer and sales data only.

Solution:

Steps Overview

  1. install data migration tool.
  2. Map tables for sales and customers only in map.xml file and skip all other unnecessary steps in config.xml file.
  3. Solve errors step by step if occurred.

1.Install http://devdocs.magento.com/guides/v2.2/migration/migration-tool-install.html

composer config repositories.magento composer https://repo.magento.com
composer require magento/data-migration-tool:2.1.x( your installed version)

2.config http://devdocs.magento.com/guides/v2.2/migration/migration-tool-configure.html

config.xml file located in vendor/magento/data-migration-tool/etc/ce-to-ce/1.9.1(your_version). if not find rename config.xml.dist to config.xml Comment all unnessary

<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="../../config.xsd">
    <steps mode="settings">
        <step title="Settings Step">
            <integrity>Migration\Step\Settings\Integrity</integrity>
            <data>Migration\Step\Settings\Data</data>
        </step>
        <step title="Stores Step">
            <integrity>Migration\Step\Stores\Integrity</integrity>
            <data>Migration\Step\Stores\Data</data>
            <volume>Migration\Step\Stores\Volume</volume>
        </step>
    </steps>
    <steps mode="data">
        <step title="Data Integrity Step">
            <integrity>Migration\Step\DataIntegrity\Integrity</integrity>
        </step>
     <!--   <step title="EAV Step">
            <integrity>Migration\Step\Eav\Integrity</integrity>
            <data>Migration\Step\Eav\Data</data>
            <volume>Migration\Step\Eav\Volume</volume>
        </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="Map Step">
            <integrity>Migration\Step\Map\Integrity</integrity>
            <data>Migration\Step\Map\Data</data>
            <volume>Migration\Step\Map\Volume</volume>
        </step>
      <!--  <step title="Url Rewrite Step">
            <integrity>Migration\Step\UrlRewrite\Version191to2000</integrity>
            <data>Migration\Step\UrlRewrite\Version191to2000</data>
            <volume>Migration\Step\UrlRewrite\Version191to2000</volume>
        </step> --> 
     <!--   <step title="Log Step">
            <integrity>Migration\Step\Log\Integrity</integrity>
            <data>Migration\Step\Log\Data</data>
            <volume>Migration\Step\Log\Volume</volume>
        </step>  -->
      <!--  <step title="Ratings Step">
            <integrity>Migration\Step\Ratings\Integrity</integrity>
            <data>Migration\Step\Ratings\Data</data>
            <volume>Migration\Step\Ratings\Volume</volume>
        </step>
        <step title="ConfigurablePrices step">
            <integrity>Migration\Step\ConfigurablePrices\Integrity</integrity>
            <data>Migration\Step\ConfigurablePrices\Data</data>
            <volume>Migration\Step\ConfigurablePrices\Volume</volume>
        </step>  -->
        <step title="OrderGrids Step">
            <integrity>Migration\Step\OrderGrids\Integrity</integrity>
            <data>Migration\Step\OrderGrids\Data</data>
            <volume>Migration\Step\OrderGrids\Volume</volume>
        </step>
      <!--  <step title="Tier Price Step">
            <integrity>Migration\Step\TierPrice\Integrity</integrity>
            <data>Migration\Step\TierPrice\Data</data>
            <volume>Migration\Step\TierPrice\Volume</volume>
        </step>  -->
        <step title="SalesIncrement Step">
            <integrity>Migration\Step\SalesIncrement\Integrity</integrity>
            <data>Migration\Step\SalesIncrement\Data</data>
            <volume>Migration\Step\SalesIncrement\Volume</volume>
        </step>
        <step title="PostProcessing Step">
            <data>Migration\Step\PostProcessing\Data</data>
        </step>
    </steps>
    <steps mode="delta">
        <step title="Customer Attributes Step">
            <delta>Migration\Step\Customer\Delta</delta>
            <volume>Migration\Step\Customer\Volume</volume>
        </step>
     <!--  <step title="Map Step">
            <delta>Migration\Step\Map\Delta</delta>
            <volume>Migration\Step\Map\Volume</volume>
        </step> -->
      <!--  <step title="Log Step">
            <delta>Migration\Step\Log\Delta</delta>
            <volume>Migration\Step\Log\Volume</volume>
        </step> -->
        <step title="OrderGrids Step">
            <delta>Migration\Step\OrderGrids\Delta</delta>
            <volume>Migration\Step\OrderGrids\Volume</volume>
        </step>
        <step title="SalesIncrement Step">
            <delta>Migration\Step\SalesIncrement\Delta</delta>
            <volume>Migration\Step\SalesIncrement\Volume</volume>
        </step>
    </steps>

map.xml file located in vendor/magento/data-migration-tool/etc/ce-to-ce/1.9.1(your_version). if not find rename from map.xml.dist to map.xml

comment those which need to migrate and <move> used to move, <field_rules> used for table fields, <document_rules> used for tables and <ignore> for ignore fields

<map xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="../../map.xsd">
    <source>
        <document_rules>

            <ignore>
              <document>googleshopping_attributes</document>
            </ignore>
            <ignore>
                <document>googleshopping_items</document>
            </ignore>
            <ignore>
                <document>googleshopping_types</document>
            </ignore>
        <!--    <ignore>
                <document>sales_flat_creditmemo_grid</document>
            </ignore>
            <ignore>
                <document>sales_flat_invoice_grid</document>
            </ignore>
            <ignore>
                <document>sales_flat_order_grid</document>
            </ignore>
            <ignore>
                <document>sales_flat_shipment_grid</document>
            </ignore> 
            <ignore>
                <document>customer_entity</document>
            </ignore>
            <ignore>
                <document>customer_entity_datetime</document>
            </ignore>
            <ignore>
                <document>customer_entity_decimal</document>
            </ignore> -->

        </document_rules>
        <field_rules>
             <move>
            <field>sales_flat_creditmemo_grid.grand_total</field>
            <to>sales_creditmemo_grid.order_base_grand_total</to>
            </move>
         <!-- source table custom  grid field-->
        <ignore>
            <field>sales_flat_invoice_grid.base_grand_total</field>
        </ignore>
        <ignore>
            <field>sales_flat_creditmemo_grid.store_to_order_rate</field>
        </ignore>
        <ignore>
            <field>sales_flat_creditmemo_grid.base_to_order_rate</field>
        </ignore>
        <ignore>
            <field>sales_flat_creditmemo_grid.store_to_base_rate</field>
        </ignore>
        <ignore>
            <field>sales_flat_creditmemo_grid.base_to_global_rate</field>
        </ignore>
        <ignore>
            <field>sales_flat_creditmemo_grid.creditmemo_status</field>
        </ignore>
        <ignore>
            <field>sales_flat_creditmemo_grid.invoice_id</field>
        </ignore>
        <ignore>
            <field>sales_flat_creditmemo_grid.store_currency_code</field>
        </ignore>
        <ignore>
            <field>sales_flat_creditmemo_grid.order_currency_code</field>
        </ignore>
        <ignore>
            <field>sales_flat_creditmemo_grid.base_currency_code</field>
        </ignore>

        </field_rules>
    </destination>
</map>

**3. RUN ** http://devdocs.magento.com/guides/v2.2/migration/migration-migrate-data.html

bin/magento migrate:data {<path to config.xml>}

Possible errors : Source documents are not mapped:(customer_)tables. check config.xml and map.xml file again if custom migration then use setting.xml also

Note: try , try and try until you will complete migration. Just focus on every errors and steps.

3
  • the above code is working?
    – senthil
    Nov 16, 2018 at 6:27
  • @senthil Yes it was working.. Any doubts ?? Nov 19, 2018 at 22:22
  • So it is not working? Jan 28, 2020 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.