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

6 Innovative Tools Revolutionizing E-Commerce Operations

E-commerce has transformed the way consumers shop for products and services and interact with businesses.…

2 days ago

How Upcoming Cookie Changes Will Affect Your E-commerce Website?

The e-commerce world is constantly in flux. New tech and strategies emerge daily to help…

2 days ago

Magento 2: How to Add Header and Footer in Checkout

Hello Magento Friends, In today’s blog, we will discuss adding a header and footer to…

3 days ago

Understanding Flexbox Layout in React Native

Hello React Native Friends, Building a visually appealing and responsive mobile app is crucial in…

5 days ago

HYVÄ Themes Releases: 1.3.6 & 1.3.7 – What’s New

We have brought exciting news for Magento store owners. Hyvä Themes recently released 1.3.6 and…

5 days ago

How Modern E-Commerce Platforms Leverage Docker & Kubernetes for Scalability

Your e-commerce platform is surging - orders are rolling in, traffic spikes are becoming the…

6 days ago