How To

How to transfer your Customers from Magento 1.x to Magento 2

The database is a well-organized collection of information that can be easily accessed, managed and updated, and this data is stored in rows, columns, and tables, and with its own index that makes it easier to fetch relevant information whenever needed. One powerful eCommerce CMS Magento relies on MYSQL Database which is completely open source and one of the most popular languages for adding, accessing and managing content in a database in an easy and flexible way. And your customer’s information plays a vital role in your business because without having your customer’s information your business is almost incapable of doing marketing and suggest products to your customers.
Sometimes it happens that the store admin wants fresh Magento 2 update without importing all the data back or admin came across a requirement of just transferring Magento 1 store customers to Magento 2 store which is a cumbersome task if you are the newbie. So, we are back with another powerful script that will help you to transfer all your customer information to your Magento 2 stores including store credentials, address and other information.
To do the same first we need to create ‘customer.php’ in Magento 1.x root folder to generate a main customer CSV file that we will later import to Magento 2 store.


After that, we need to create one more ‘customeraddress.php’ script in the same location of Magento 1.x root folder for creating all customer address CSV file.


After running both the script in your Magento 1.x root folder now you can find “customer.csv” file that is generated using the first script and “customerAddress.csv” file that is generated after successful execution of the second script.
Now it’s time to import these CSV files into your Magento 2 backend and for that purpose navigate to System->Import

For importing “customer.csv” file select “Customers Main File” option from the dropdown and for importing “customerAddress.csv” select Customer Addresses option from the dropdown and select remaining option according to your business need.

That’s it! If you found this blog helpful, don’t forget to share it with your colleagues and Magento Friends.
And, Let us know if you are facing an issue while implementing this code.
Happy Transfer!

Click to rate this post!
[Total: 23 Average: 5]
Dhiren Vasoya

Dhiren Vasoya is a Director and Co-founder at MageComp, Passionate ?️ Certified Magento Developer?‍?. He has more than 9 years of experience in Magento Development and completed 850+ projects to solve the most important E-commerce challenges. He is fond❤️ of coding and if he is not busy developing then you can find him at the cricket ground, hitting boundaries.?

View Comments

  • Exactly what I was looking for - thanks.
    However, I have an issue with the GroupID information - this is set to '1' for all customers. Anything I made wrong or it that not covered?

    • The code for the Group Id is there, but currently, we pass static there, but you can make it dynamic when you export the data according to your requirements.

  • Hi,
    Thanks for this solution. Think it's exactly what I need but the second script gives me an error. First script customer.php runs great and gives me an nice csv file but when I run the second script customeraddress.php I get this error. I've copy paste it several times and run it.

    php -f /home/itennis/domains/itennis.nl/public_html/customeraddress.php
    PHP Fatal error: Uncaught Error: Call to a member function getID() on boolean in /home/xxxxx/domains/xxxxxxx.xx/public_html/customeraddress.php:29
    Stack trace:
    #0 {main}
    thrown in /home/xxxxx/domains/xxxxxxx.xx/public_html/customeraddress.php on line 29

    Could you please help me?

    • Kindly check there should be some customers whose default billing or shipping address are not set, possible reason of the error.

      • The same problem happened to me. How do you easily identify the customers whose default billing or shipping are not set?

        • Kindly check for which customer this script gives you an error, actually that customer might have some issues like some entry deleted from the database or something like that

Recent Posts

How to Add Tooltip in Checkout Shipping Field in Magento 2?

Hello Magento Friends, In today’s blog, I will explain How to Add Tooltip in Checkout…

3 days ago

How to Integrate and Use MongoDB with Laravel?

MongoDB is a popular NoSQL database that offers flexibility and scalability when handling modern web…

4 days ago

NodeJS | Callback Function

In NodeJS, callbacks empower developers to execute asynchronous operations like reading files, handling requests, and…

5 days ago

How to Show SKU in Order Summary in Magento 2?

Hello Magento Friends, In today’s blog, we will learn How to Show SKU in Order…

7 days ago

Best Colors to Use for CTA Buttons

The "Buy Now" and "Add to Cart" buttons serve as the primary call-to-action (CTA) elements…

1 week ago

Magento 2: How to Save Custom Field Value to quote_address for Multi-Shipping Orders

Hello Magento Friends, In Magento 2, the checkout process allows customers to choose multiple shipping…

1 week ago