Are you a store owner looking to clean up your WooCommerce store? Perhaps you’ve migrated your site, run a test store, or dealt with many spam user accounts. Whatever the reason, you might want to delete all customers in WooCommerce. This can seem like a daunting task, but it’s a necessary step for maintaining a clean and efficient user database.
This comprehensive guide will walk you through the various methods to perform a bulk deletion of customer accounts. We’ll cover everything from the most straightforward manual approach to advanced techniques using SQL queries and WP-CLI. We’ll also discuss the critical considerations you must address before you start, ensuring a smooth process without data loss. By the end of this post, you’ll have all the answers you need to manage your customer list effectively.
Why Delete All Customers in WooCommerce?
A store owner might need to delete all customers in WooCommerce for several valid reasons. Cleaning out old or irrelevant user data is crucial to store management. One common scenario is after a website migration or a major site overhaul. You might have a new user registration system or want to start fresh without old customer information.

Another significant reason is the presence of spam accounts. If your store has a public user registration page, it’s susceptible to bots and spammers. These fake customer accounts can clutter your user database, slow down your site performance, and even pose security risks. Deleting these users helps improve site speed and security.
Furthermore, you might be testing a new store setup or a plugin. After the testing phase, you may want to delete WooCommerce customer data to prepare for a live launch. This ensures your customer list is accurate from day one. Regularly deleting inactive customer accounts can improve your store’s efficiency and overall user management. It’s a good practice to keep your user database lean and clean.
Need Expert Help Managing Your WooCommerce Store?
Let WPServices handle the heavy lifting with our reliable White Label WordPress solutions tailored for WooCommerce.
Before You Begin: Key Considerations
Before you start any bulk deletion operation, it is essential to understand the potential impact and take necessary precautions. Deleting customer accounts is irreversible, so you must proceed cautiously. The most critical step is to completely back up your site, including your files and database.
First, you must understand the difference between a user and a customer in WooCommerce. A customer is simply a WordPress user with the “customer” role. Deleting a customer means deleting their WordPress user account, which will also delete all associated user data and metadata.
Learn More: How to Use Elementor WooCommerce Builder
Understand the Impact of Deleting Customers
Deleting a customer account permanently removes their user ID, username, email address, and personal information, including shipping and billing addresses. A crucial point to remember is how this affects their order records. While deleting the customer account removes the user, the order records might remain in the database. The order will be orphaned, meaning it will no longer be linked to a specific user. This can cause issues with your reports and customer management in the future.
This is a critical point for store owners. You must be careful if you need to retain historical order information for tax or business purposes. You might consider alternative methods like anonymizing customer data instead of completely deleting it. This preserves the order count and other key details without retaining personal information.
Explore More: How to Add a WooCommerce Product
Difference Between Deleting vs. Anonymizing Customers
Complete deletion removes the user and all their associated data from the database. On the other hand, anonymization changes personal information (like name and email) to generic placeholders. For instance, the username might change to “anonymous user,” and the email address might be replaced with a dummy value.
Anonymizing is a great solution if you need to comply with privacy regulations like GDPR while retaining sales data. It lets you keep the order records intact for your business analytics and reporting without storing personally identifiable information. This option is much safer if you are concerned about data loss but want to clean up your user data. This guide will focus on the complete deletion process, but knowing this distinction is important.
Also Read: How to Change the Empty Cart Message in WooCommerce
How to Export Customer Data Before Deletion?
As we’ve stressed, backups are crucial. Another vital step is to export your customer data. This creates a safety net and records your customer list before you perform the bulk deletion. Having this data can be a lifesaver if you accidentally delete the wrong user accounts or need to restore a user.

Exporting via WooCommerce Reports
WooCommerce has a built-in reporting system that allows you to see your customer information. While not a direct export tool for all details, you can find valuable data. Navigate to WooCommerce → Reports → Customers. You can filter by customer type, number of orders, and total spent here. While you can’t export all user data from here, it gives you a good overview.
Using Plugins to Export Customers to CSV
Using a plugin is the best solution for a complete and easy-to-manage export. Many plugins on the WordPress plugin repository can export customer information to a CSV file. A popular option is the “Customer / User CSV Export” plugin.
To use such a plugin, follow these steps:
- Go to Plugins → Add New in your WordPress dashboard.
- Search for “Customer / User CSV Export”.
- Install and activate the plugin.
- Navigate to the plugin’s settings, usually found under Tools or WooCommerce.
- Select the user roles you want to export (e.g., ‘customer’).
- Choose the fields you must include in the export (username, email ID, shipping details, etc.).
- Click the “Export” button. The plugin will generate a CSV file that you can download.
This CSV file is your backup of all customer accounts and their details. Save it in a safe place before moving on to the next section.
Further Reading: Unlimited Support vs Hourly WooCommerce Help: Which is Right for You
Methods to Delete All Customers in WooCommerce
Now that you have a customer data backup, you can proceed with the bulk deletion. We will explore five different methods, from the most straightforward to the most advanced. Choose the one that best suits your technical comfort level.
Method 1: Manual Deletion via WordPress Dashboard
This is the simplest method, but it is also the most time-consuming. It’s only practical if you have a small number of customer accounts to delete.
- Log in to your WordPress dashboard.
- Navigate to Users → All Users.
- You will see a list of all user accounts on your site on the user list page. Use the filters at the top to display only the “Customer” role.
- You can select multiple users by checking the boxes next to their names.
- Once you have selected the users you want to delete, choose “Delete” from the “Bulk Actions” dropdown menu.
- Click “Apply”.
- A confirmation screen will appear, asking if you want to delete all posts and links created by the user. Since customers typically don’t make posts, you can usually leave this as “Delete all content.”
- Click “Confirm Deletion”.
The main drawback of this method is that you can only delete a limited number of users at a time (usually 20 or 50, depending on your screen options). For a large customer list, this is not an efficient solution.
Method 2: Bulk Delete Customers Using SQL Queries
This method is powerful and efficient, but requires direct access to your database via a tool like phpMyAdmin. It’s crucial to have a recent backup of your database before attempting this. One wrong query can cause severe data loss.
- Access your cPanel or hosting control panel.
- Open phpMyAdmin.
- Select your WordPress database from the list on the left.
- Click on the “SQL” tab.
- Enter the following SQL queries. These queries are designed to delete all users with the “customer” role.
First, you need to find all user IDs with the customer role:
SELECT user_id FROM wp_usermeta WHERE meta_key = 'wp_capabilities' AND meta_value LIKE '%"customer"%';Next, you will need to delete these users from the various tables in which they exist. Remember to replace wp_ with your database table prefix if it’s different.
To delete the users from the wp_users table:
DELETE FROM wp_users WHERE ID IN (SELECT user_id FROM wp_usermeta WHERE meta_key = 'wp_capabilities' AND meta_value LIKE '%"customer"%');
To delete their metadata from the wp_usermeta table:
DELETE FROM wp_usermeta WHERE user_id IN (SELECT user_id FROM wp_usermeta WHERE meta_key = 'wp_capabilities' AND meta_value LIKE '%"customer"%');
Finally, to delete entries from the wp_wc_customer_lookup table, which is a new table in WooCommerce for better reporting:
DELETE FROM wp_wc_customer_lookup WHERE user_id IN (SELECT user_id FROM wp_usermeta WHERE meta_key = 'wp_capabilities' AND meta_value LIKE '%"customer"%');Important: These queries will delete all users with the customer role, including any legitimate customer accounts. Double-check your queries and have a backup before running them.
Discover More: How to Change Your WooCommerce Logo
Method 3: Delete Customers with No Orders
Sometimes, you only want to delete customers who have never purchased. This is a great way to clean up your user database and remove spam or inactive user accounts without affecting your legitimate customer base.
You can achieve this with a more specific SQL query:
- Access phpMyAdmin as in Method 2.
- Run the following query to identify users with no orders. Remember to replace
wp_with your table prefix.
SELECT ID FROM wp_users WHERE ID NOT IN (SELECT post_author FROM wp_posts WHERE post_type = 'shop_order' GROUP BY post_author);This query will return a list of user IDs that have not authored any shop_order posts. You can then use these IDs to perform a bulk deletion.
A more straightforward way to do this is with a plugin. Many user management plugins offer filters to delete users based on their order count. This is a much safer option if you are not comfortable with SQL.
Method 4: Using Plugins for Bulk Customer Deletion
A plugin is the safest and most user-friendly way to perform a bulk deletion. There are several plugins available that simplify the process and provide additional options, like filtering users. A popular choice is the “Bulk Delete” plugin.
- Go to Plugins → Add New and search for “Bulk Delete”.
- Install and activate the plugin.
- After activation, you will find a new menu item, often under “Tools” or its menu.
- Navigate to the plugin’s interface. You’ll see various options for bulk deleting content.
- Find the section for deleting users.
- You can set filters to delete users by role (e.g., “customer”), registration date, or even by a specific username or email.
- Select the “customer” role.
- Review the options carefully and click the “Delete” button. The plugin will handle the deletion process safely and efficiently.
This method is recommended for most store owners as it reduces the risk of error and does not require technical knowledge of SQL.
Method 5: WP-CLI for Advanced Users
For developers and advanced users who manage their sites via the command line, WP-CLI (WordPress Command Line Interface) is a powerful tool. It allows for quick and efficient bulk operations.
- Access your server via SSH.
- Navigate to your WordPress root directory.
- Use the
wp user listcommand to identify the users you want to delete. You can filter by role:
Bash
wp user list --role=customer- This command will give you a list of customer user IDs. You can then use a combination of commands to get a list of IDs and pass them to the delete command. A powerful one-liner to delete all users with the customer role is:
Bash
wp user list --role=customer --field=ID | xargs wp user delete This command lists all user IDs with the customer role and then pipes those IDs to the wp user delete command, effectively deleting them all in one go.
Warning: This command is compelling and irreversible. Use it with extreme caution and only after a complete backup.
Automating Customer Cleanup on a Schedule
For ongoing store maintenance, you might want to automate the process of cleaning up inactive or spam user accounts. This is especially useful for high-traffic sites with many user registrations.
Set Scheduled Deletion with WP-Cron or Plugins
You can use WordPress’s built-in cron system (WP-Cron) to schedule a deletion process. This usually involves writing a custom PHP script that hooks into the WP-Cron system. The script would run at a specified time (e.g., once a month) and perform the bulk deletion based on your criteria.
Alternatively, some plugins offer this functionality out of the box. For example, the “Bulk Delete” plugin often has features to schedule deletion tasks, so you can set it to run automatically without manual intervention.
Automatically Remove Inactive or Unverified Users
Another strategy is automatically deleting users who haven’t logged in for a long time or verified their email address. This is a great way to manage inactive accounts. Some plugins can track the last login date and automatically delete a user after a specific period of inactivity. This helps keep your user database clean and focused on active customers.
Best Practices for Safe Customer Deletion
Deleting customers is a sensitive operation that can impact site functionality, data integrity, and compliance. Follow these best practices to ensure a smooth and secure process.

- Always Back Up: This cannot be stressed enough. Back up your entire site (files and database) before any major operation.
- Export Customer Data: Keep a CSV file of your customer information as a secondary backup.
- Test on a Staging Site: If possible, perform the deletion on a staging or development site first. This lets you see the results and iron out any potential issues without affecting your live store.
- Start with a Small Batch: If you use a manual method, delete a small group of users to ensure everything works as expected.
- Understand the Impact: Be fully aware of what happens to customer orders and data after deletion. Based on your business needs, choose the right method (deletion vs. anonymization).
Discover Further: How to Easily Hide the WooCommerce Cart Icon
Troubleshooting Common Issues of Deleting Customers
Even with the best preparation, issues can sometimes arise. Here are some common problems and their solutions.
Orders Still Showing After Deleting Customers
As mentioned earlier, deleting a customer account does not necessarily delete their order records. The order will remain in the database but be assigned to a generic “Guest” user. The solution is to delete the orders separately or use a plugin that handles user and order deletion. You can also use a specific SQL query to delete the orders associated with the customer role, but this should be done with extreme care.
Metadata Not Fully Removed
Sometimes, user metadata (like shipping addresses, billing info) might be left behind after a deletion. This is often because a plugin stores custom metadata in a separate table. The best way to ensure all data is removed is to use a comprehensive deletion plugin or to manually check your database tables for orphaned data after the process.
Plugin Conflicts During Deletion
A plugin conflict can cause the deletion process to fail or lead to errors. If you encounter issues, try deactivating other plugins individually to identify the one causing the conflict. A common conflict occurs when a plugin has a custom user role or stores user data in a non-standard way.
Conclusion
Deleting all customers in WooCommerce is a significant task that requires careful planning and execution. Whether you are dealing with spam accounts, cleaning up a test store, or complying with data privacy laws, having a solid plan is essential.
We’ve covered several methods, from the simple manual approach to advanced SQL queries and WP-CLI commands. We’ve also highlighted the importance of backups, exporting customer data, and understanding the difference between deleting and anonymizing accounts. By following the best practices outlined in this guide, you can confidently and safely manage your customer list and maintain a clean, efficient, and secure WooCommerce store.
FAQs About Deleting All Customers in WooCommerce
How do I delete all customers in WooCommerce?
You can delete all customers using the “Bulk Actions” feature in the WordPress dashboard, running SQL queries in phpMyAdmin, or using a plugin like “Bulk Delete.” The best method depends on the number of users and your technical expertise.
How do I delete all orders in WooCommerce?
To delete all orders, you can use a plugin like “Bulk Delete.” You can also run an SQL query in phpMyAdmin: DELETE FROM wp_posts WHERE post_type = 'shop_order' OR post_type = 'shop_order_refund';. Always back up your database first
How do I delete all users on WordPress?
You can delete all users (except for the admin you are logged in as) by navigating to Users → All Users, selecting them, and using the “Bulk Actions” dropdown. For a large number of users, an SQL query or a plugin is more efficient.
How do I delete all WooCommerce products at once?
In the WordPress dashboard, go to Products, select all, and use the “Bulk Actions” dropdown to move them to the trash. For many products, using an SQL query DELETE FROM wp_posts WHERE post_type = 'product'; is much faster.
How do I export all customers from WooCommerce?
The best method is to use a plugin designed for this purpose, such as “Customer / User CSV Export.” This allows you to easily download a CSV file containing all customer information.
How do I clear all sessions in WooCommerce?
You can clear all WooCommerce sessions by accessing your database via phpMyAdmin and running a query to delete all transients related to sessions. The query would look something like: DELETE FROM wp_options WHERE option_name LIKE '_wc_session_%';. This is a valuable step for troubleshooting.


