The following WP-CLI command is a really easy way to delete all existing WooCommerce customer accounts on a WordPress website:
wp user list --field=ID --role=customer | xargs wp user delete --yes
And the best part: all of the information from the customers’ existing orders remained in-tact as well!
6 replies on “How to Bulk Delete all WooCommerce Customer Accounts”
RT @om4james: How to bulk delete all #WooCommerce customer accounts using @wpcli: http://t.co/eHrGaXxJ2G #WordPress
How to bulk delete all #WooCommerce customer accounts using @wpcli: http://t.co/rZgAo0ul8p #WordPress #WP #eCommerce
Thanks James, this is a great idea and using xargs makes wp-cli even more valuable.
Thanks David, happy to help!
Fantastic! Any ideas on the wp-cli command to delete all order post-types too?
Ta
E
Hi Elliot,
This approach of moving them to the trash then emptying the trash could be the best way to achieve this.
James