Website Design Hub

remove all woocommerce products

Remove ALL WooCommerce Products in Bulk

Ever needed to delete your products in your Ecommerce store with WooCommerce?

Well, that’s easy if you have a few hundred products, but what if you have thousands of products? Maybe you’d like to delete them all and reupload a new product CSV for whatever reason.

Right now I’m showing you the fastest and simplest way of deleting products in bulk from your WooCommerce store.

So as with most things there are various methods to most things, especially in WordPress. And there are indeed multiple ways to remove products in bulk… well sort of. If you use Woocommerce, you could select all your products on that page and simply delete them all. And you can of course select screen options at the top and increase the number of products to show on that page, but only till about a 100 before the database bogs down and either has a tediously slow result or stops responding altogher, and a 100 products is if you have good hosting, bad hosting won’t even get you to 50. But what about thousands of products?

If you or your customer runs a dropshipping store or you really do have thousands of products on your site you’ll from time-to-time or possibly even on a weekly or monthly bases need to clear your products and re-upload a CSV file.

Now When using WP All Import this can be maintained fairly efficiently without touching your database MANUALLY and just overriding your products with new information. I have a video about WP All Import which I’ll link in the description if you wanted to check that out.

But Even so, it does happen that you would like to quickly and effectively clear your products all altogther and this is what this video is all about so let’s jump right in.

The code required for your SQL Database:

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';

from MyPHPAdmin, expand your database by clicking on the plus sign. Then look for the WP Posts entry, then click on the SQL tab. Next, I’ve left a link in the description where you can find the code to copy. Once you’ve copied the code from my website, come back to the SQL screen. If there is a line of code in there, clear the screen and copy in the script from my website. Next click on the Go button and let it run the script. The more products you have, the longer it will take but it’s generally a nice and quick experience.

That’s about it! You can now visit your website and check if the script has done it’s job.

Leave a Comment

Your email address will not be published.