WooCommerce » 🗑️ Bulk Delete WooCommerce Products with WP CLI

🗑️ Bulk Delete WooCommerce Products with WP CLI

Here are a few useful one-liners that you can use to quickly remove all WooCommerce products from your store.

wp post delete $(wp post list --post_status=trash --post_type='product' --format=ids --posts_per_page=10000) --force

Another approach:

wp post list --field=ID --post_type=product --posts_per_page=10000 | xargs wp post delete --force

If you are considering deleting items in WooCommerce, please be aware that this action cannot be undone. Once you have deleted an item, it will be permanently gone from your store. Before taking this action, please be absolutely sure that you no longer need or want the item in question.

I played a bit using the WPCLI commands and tried to determine the fastest way to remove all WooCOmmerce products, and besides SQL WP-CLI is the way to go.

Was this post helpful?

Leave a Comment

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.