Remove all products, categories and terms from WooCommerce at once

Posted by

Go to phpMyAdmin

Select the Database, you have your WordPress website connected to.

Choose the SQL tab in the top, next to Structure

Insert the following

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

Press Go

Wait patiently …

Leave a Reply

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