How to delete all products from WooCommerce? This is a question that many site owners or store owners ask themselves when they are deciding to clean up their website from all WooCommerce products.
There are many reasons why store owners may want to delete all the products from their store, but whatever the reason, it can be accomplished! In this guide, I will show you how to delete all the products from WooCommerce.
Delete all Products from Woocommerce
I’ll be using two simple methods to delete all products from WooCommerce. The first method is to delete all the products manually and the second method is by running an SQL Command in PHPMyAdmin Portal.
Method 1) Manually Delete all Products from WooCommerce
if your site has a few products up to hundreds, then you can easily delete all the products manually from your site. First, log in to your WordPress Dashboard and go to Products » All Products
At the top of your products page, you will see the screen options dropdown, click on it and there you will see No of items per page input, here enter the value of no of products on your site which has to be deleted like if there are hundred products then enter 100 and click on apply.
Now all the products will be loaded on your page, select all products and then click on the Bulk Actions dropdown to select Move to trash, and click on Apply. All the products will be now moved to the trash
Note: These products are not permanently deleted and are moved to the trash.
To permanently delete all products, click on Trash and here again select all the products, click on the Bulk Actions dropdown to select Delete permanently, and click on Apply. So all the products will be now permanently deleted from your site. Or directly click on Empty Trash to permanently delete all products from the trash.
These all are just 6 simple steps:
- Log in to WordPress Dashboard.
- Go to Products » All Products.
- Click on Screen Options dropdown on the top of your products page.
- Enter 100 or 200 in No of items per page input and click on Apply.
- Now select all the products, click on Bulk Actions to select Move to Trash, and click on Apply so the products will be moved to the Trash.
- To permanently delete all products, open Trash and again click on Bulk Actions to select Delete permanently, click on Apply and all the products will be now Deleted permanently.
You May like:
How to Make Accordion Closed by Default Elementor
How to Add an Email Link in WordPress ( Easy Method )
How to Embed an iFrame code in WordPress ( 3 Easy Ways)
If your site has a lot of products, then the above method of manually deleting all products from your site will take a lot of time. So in this case, you can use the second method to delete all products from WooCommerce using SQL Command.
Method 2) Delete all Products from WooCommerce using an SQL Command
If you have more than 1000 products in your store, then manually deleting them might be time-consuming. In this case, you can use SQL Command to delete all products from your WooCommerce store.
First login to PHPMyAdmin Portal, here select your WordPress database that has all the products to be deleted, select the wp_posts table and run the below SQL statement:
DELETE relations.*, taxes.*, terms.* FROM wp_term_relationships AS relations INNER JOIN wp_term_taxonomy AS taxes ON relations.term_taxonomy_id=taxes.term_taxonomy_id INNER JOIN wp_terms AS terms ON taxes.term_id=terms.term_id WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation')); DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation')); DELETE FROM wp_posts WHERE post_type IN ('product','product_variation');
After executing the above SQL statement, you will see that all of the products from your WooCommerce store have been deleted.
Note: Always make a backup of your WordPress site whenever you are editing with some code files or database so in case if something goes wrong then you may have a backup available.
If you are a WordPress novice then I don’t recommend you to use this SQL Command method to delete all products from your WooCommerce store because if you made any mistake then you might get into trouble.
Instead, you can use the first method to delete all products from WooCommerce manually which is very simple and easy to use.
FAQ( How to Delete all Products from WooCommerce )
How can I bulk delete all products from WooCommerce?
To delete all products from WooCommerce, Log in to WordPress Dashboard go to Products » All Products, and there Click on Screen Options dropdown on the top of your products page. There you will see No of items per page, enter a large number and click on apply so all of your products are loaded on the page
Select all the products, click on Bulk Actions dropdown to select Move to Trash, and click on Apply so the products will be moved to the Trash. Now to permanently delete all products, open Trash and again click on Bulk Actions dropdown to select Delete permanently, click on Apply and all the products will be now Deleted permanently.
How can I delete all products from WooCommerce with code?
To delete all products from WooCommerce with code, First Login to PHPMyAdmin Portal select your WordPress database that has all the products to be deleted, select the wp_posts table and run this SQL command:
DELETE relations.*, taxes.*, terms.* FROM wp_term_relationships AS relations INNER JOIN wp_term_taxonomy AS taxes ON relations.term_taxonomy_id=taxes.term_taxonomy_id INNER JOIN wp_terms AS terms ON taxes.term_id=terms.term_id WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation')); DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation')); DELETE FROM wp_posts WHERE post_type IN ('product','product_variation');
Conclusion
In this article, I have explained two methods to delete all products from WooCommerce. The first method is to delete all products manually and the second method is to use an SQL command to delete all products.
Method one is very simple and easy to use for WordPress novices but if you experienced WordPress developer and the first method is a Lil bit time-consuming for you and you want to delete all products using code then go for the second method.
But I must say be careful while working with the database and code files because any small mistake can ruin your WordPress site. Always make a backup of your WordPress site before editing code.
If you have any questions or suggestions then feel free to leave a comment below. I will try my best to answer your question. Also, If there is anything else you would like us to cover, feel free to contact us via the comments section. Thanks for reading!