How to Properly Delete All WooCommerce Products

Have you ever thought that you will remove all the current products and import product the new ones?  To Delete All WooCommerce Products is extremely necessary at this moment. So far, woocommerce has not had a proper feature to do this task. If you have just 10 products, you can do it manually. But if you have 10.000 products, you have another thought. There are some fee-charging plugins but I have never used them. I have used some free plugins but they do not support you to delete taxonomy.

To me, deleting products by with database is quickest and simplest. If you follow this article, you may do it better than me because you just need to copy and click the “run” command.

Log inphpmyadmin

There are several ways to log in. You can get access to the link youdomain/phpminiadmin or use phpminiadmin.php. Or you can carry out in the cpanel of hosting. If you are not sure about this, you should contact your hosting supplier. If there is more than one database and you are not sure which database you are working with, you should open the database and get to wp_options. This table lets you know which url of the website the database is working on.

Or you can open wp-config.php file to check the corresponding database.

Run the SQL command

After defining the exact database, the first thing to do is back up the database because you may destroy your website accidentally. Next, you click on SQL as below

Delete All WooCommerce Products

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=’product’);

DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type = ‘product’);

DELETE FROM wp_posts WHERE post_type = ‘product’;

Delete All WooCommerce Products

Now, click on Go. All the products will be deleted. If it shows error, commonly it is due to your wrong prefix. The code uses default WordPresswp_. However, if you use automatic installation service of the hosting supplier, the code may be changed. You should check if the name of the table is right. On the left of the screen, it has the format of prefix_post, as wp_post by default. You should edit it properly.

The article Delete All WooCommerce Products ends here. If you have any question, please contact us. As we have mentioned, this solution is used when you want to import all new products. If you use Prestashop, you could try using Import product module here https://addons.prestashop.com/en/fast-mass-updates/27281-csv-import-products.html You can use the demo site before deciding to own this module. You are also provided with technical support by the support team when using it.

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *