Your Dedicated Partner for All Things WordPress

How to Delete All Customers in WooCommerce

Table of Contents

Deleting all WooCommerce customers from your database is not as straightforward as it seems. Even though it can be done manually, for online stores with a large number of customers the application of such a method is slow and arduous. Thankfully, there are quite a few ways how we can delete WooCommerce customers. Let us take a look at the most common approaches.

Deleting All WooCommerce Customers Manually

If your WooCommerce online store has a relatively small number of customers, then manually deleting them is quite efficient.

Go to your WordPress dashboard and locate the Users tab. Click on it and you will be re-directed to the Users window.

WooCommerce delete users

Right above the user list, you will see different tabs for various user roles. Find the Customers tab and click on it. You will see a list with all WooCommerce customers registered on your WordPress database.

WooCommerce customers

By default, WordPress displays 20 users per page. If the number of customers in your case is higher, then locate the Screen Options tab in the upper right corner and click on it.

WordPress screen options

Set the Number of Items Per Page option accordingly, so it would display all of your customers on a single page. Click the Apply button afterward to save changes.

Pagination customers

You can select all customers instantaneously by ticking the checkbox underneath the Bulk Actions window. If you want to delete only specific customers, then you will need to tick each box manually.

Delete all WooCommerce customers

Now that you have selected all customers, click on the Bulk Actions window and select the Delete option. Click on the Apply button to confirm your selection.

delete all customers

You will be re-directed to the Delete Users window. It is just an extra step that you have to do in order to confirm the action. When deleting a user, any user, you should tread carefully. You delete any data associated with the user too, so, consequently, there might be cases when you remove something you might not want to. Anyways, click on the Confirm Deletion button.

WooCommerce customer deletion

Now all of your customers have been deleted and you can start afresh.

Deleting All WooCommerce Customers via SQL and WP-CLI

Usually, a WooCommerce online store has hundreds of customers, so deleting them manually can be incredibly time-consuming. With some knowledge in coding, you can quickly solve this issue via SQL queries or WP-CLI. We will take a look at 2 different cases concerning customer deletion and provide you with the necessary code.

Customers with 0 Orders

There are times when your database is full of registered WooCommerce customers that have not made a single order. This number of customers can reach thousands, in return, slowing down your website.

Login to your phpMyAdmin account. Before proceeding, confirm that the script will be run on the correct database. To ratify whether the correct database is loaded, look for the table wp_options and check if it has the correct URL for your website. Always backup your website before running any script! Otherwise, you may lose significant data or even render the website inaccessible. You should regularly take precautions when running advanced SQL queries.

SQL queries

Now that you have located the SQL panel, select the wp_posts table and paste the code below. If your database prefix is not wp_, then replace it with the prefix you are using. This piece of code will determine which customers have 0 orders and 0 posts. Press the Go button to execute the SQL statement.

SELECT * from wp_users where wp_users.ID not in (

SELECT meta_value FROM wp_postmeta WHERE meta_key = ‘_customer_user’

) AND wp_users.ID not in (

select distinct(post_author) from wp_posts


If the query is executed properly, then you will need to substitute SELECT * with DELETE in order to delete all WooCommerce customers with 0 orders. We have done it in your stead and can just copy the code below. Press the Go button to execute the SQL statement.

DELETE from wp_users where wp_users.ID not in (

SELECT meta_value FROM wp_postmeta WHERE meta_key = ‘_customer_user’

) AND wp_users.ID not in (

select distinct(post_author) from wp_posts


At last, all of your WooCommerce customers with 0 orders have been deleted. Now you should clear up user meta to get rid of any leftover data. In the same manner, paste the code below and press the Go button to execute the SQL statement.

delete from wp_usermeta where wp_usermeta.user_id not in (select ID from wp_users);

You can take a look at your WooCommerce user list to confirm whether or not all users have been deleted. If there are some inconsistencies, then, most likely, you have forgotten to swap the database prefix wp_ with whatever your database uses.

Deleting All Customers

Honestly, deleting all WooCoomerce customers via SQL is rather complicated. With an improper query, you run the risk to delete all users, and the query in itself is very long and complex. We recommend using WP-CLI for this task. You can take a look at their documentation here on how to set up WP-CLI command-line interface.

WP-CLI delete customers

Take a look at the command below. It is a simple one-line command utility for deleting all WooCommerce customer data. Additionally, you will not have to worry about damaging your database.

wp user list –field=ID –role=customer | xargs wp user delete –yes

Keep in mind that this command deletes only customers, all of the data concerning their orders has remained intact. If you want to delete all WooCommerce orders too, then take a look at our article here.

Deleting All WooCommerce Customers via Plugins

If you are not savvy with coding and databases in general, then consider using plugins. Unfortunately, there are not many plugins that can delete all WooCommerce customers and their corresponding data. Although there are plugins that reset databases, not many of them have functionality for this specific task. Let us take a look at 3 popular plugins that can be used to delete all WooCommerce customers.

WP Reset. The most popular plugin for resetting sites databases to the default installation values without modifying files. It is a fast and efficient way of targeting specific data and removing it. With multiple fail-safe mechanisms integrated into the plugin, you will be able to restore any data you have accidentally deleted. We advise you to carefully take a look at the documentation in order to understand how to select and target the data you desire.

Store Toolkit for WooCommerce. This plugin includes a growing set of commonly-used WooCommerce administration tools, mainly, aimed at web developers and store maintainers. With a large set of maintenance/debugging/clearing tools at your disposal, you will be able to delete any data concerning WooCommerce.

Smart Manager for WooCommerce. For the most part, this plugin is used to increase WooCommerce functionality and add additional tools for managing your store, but it can be used to clear your database from unnecessary customer data. The plugin has a free(lite) version and a paid one.

Final Words

As you can see, managing WooCommerce online store requires some technical knowledge. Even a seemingly simple task, like deleting all customers, can turn out to be challenging. The aforementioned solutions will help with accomplishing this task. Again, be careful when running SQL queries, double-check the syntax and always back up your database. We wish you a bug-free journey through the world of e-commerce and stay tuned for more articles!

How to get started?

Learn more

WooCommerce Maintenance

Save 33% with our Annual pricing plan.

Get Started

Looking for help? Chat with us.

Are you in need of assistance or guidance? Look no further! Our dedicated team is here and ready to help. Chat with us today and let’s work together to find the perfect solution for your needs.

Our support team will get you:

I believe every website owner deserves a reliable professional support always by their side.

Alexey Seryapin
Founder of WPServices

Having Troubles With WordPress?

Claim Your Free WordPress Maintenance

In today’s fast-paced digital landscape, every website deserves the care and expertise of a professional maintenance team, ensuring optimal performance, enhanced security, and seamless user experiences, so you can focus on growing your business with peace of mind.

Alexey Seryapin
Founder of WPServices

Coupon Code Applied!

Take your time and continue browsing our services.

Alexey Seryapin
Founder of WPServices