To import customers into WooCommerce, you should use a high-quality third-party plugin. The alternative is to custom code a solution, which isn't particularly wise, since you'd have to write data to core WordPress tables such as wp_users and wp_usermeta.
If you also want to import WooCommerce order data and link that data to your imported customers, you'd have to overwrite the _customer_user field of the wp_postmeta table so that it uses the new user IDs generated by your WooCommerce customer import.
Put another way, importing customers into WooCommerce using custom code is not for the faint of heart. You're much better off leaving this to a true-and-tried professional plugin.
The best plugin on the market to perform this task is WP All Import. Not only will it allow you to import customers into WooCommerce. It will also handle any linking issues between WooCommerce customers, orders, and products. If any other themes or plugins have added additional customer fields, it will let you import data into those fields, too. And if you need to filter your customer imports or schedule them to occur on a regular basis, it does that, as well.
Back Up Your Database Before You Import WooCommerce Customers
As we recommend with most data imports that affect core WordPress or WooCommerce tables, we strongly advise you to back up your website's database before attempting your customer import. To be absolutely sure that you have a viable recovery process, you should restore this data to a test site, then check to make certain the data looks okay before proceeding.
It's unlikely that you'll ever need a backup when using a proven plugin like WP All Import, but as the saying goes, it's always better to be safe than sorry.
How to Import Customers into WooCommerce
- Install the pro versions of WP All Import and the WooCommerce Add-On.
- Go to All Import > New Import and choose how to import your WooCommerce customer file. You can upload it, download it from a URL or FTP/SFTP site, or use a file that you've previously uploaded on your server.
- Select WooCommerce Customers as your import target.
- Use the Drag & Drop interface to map incoming data elements to their correct WooCommerce customer fields.
- When the import is complete, check your imported customers to ensure that their data is correct.
How to Import Customers into WooCommerce — Related Documents
How to Import WooCommerce Customers
The official documentation for importing WooCommerce customers. This document walks you through the basics of importing customers. It also describes advanced topics like how to keep an old Customer ID after import, and how to work with customer password data.
Import WooCommerce Customers (plugin description)
A complete description of WP All Import's WooCommerce customer import features and capabilities.
How To Export WooCommerce Customers to CSV, Excel, and XML
The official documentation on how to export WooCommerce customers. Again, you get a basic walkthrough plus a description of advanced topics like filtering WooCommerce customer exports, setting advanced options, and how to export customers to different file types.
How To Export My WooCommerce Customer List
A shorter version of the preceding document, with a focus on exporting a customer list.
How do I Get Customer Details in WooCommerce?
A short article on how to get customer details from WooCommerce, whether as a quick inquiry or a file export.
How to Migrate WooCommerce Customers
Explains how to migrate WooCommerce customers, which really consists of exporting customers from one site and importing them to another site. This article describes how to do this with WP All Export and WP All Import using only a few clicks.
How to Import Customers into WooCommerce — Related Videos