If you need to reset your site’s list of products and variations, the following query can be run in php
MyAdmin:1DELETE relations.*, taxes.*, terms.* 2FROM wp_term_relationships AS relations 3INNER JOIN wp_term_taxonomy AS taxes 4ON relations.term_taxonomy_id=taxes.term_taxonomy_id 5INNER JOIN wp_terms AS terms 6ON taxes.term_id=terms.term_id 7WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type like'product%'); 8 9DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type like 'product%'); 10DELETE FROM wp_posts WHERE post_type like 'product%';
This will not delete any imported media, but the media will be orphaned and can be deleted. There are plugins to do this or you can follow the instructions here.
<code>1DELETE relations.*, taxes.*, terms.* 2FROM wp_term_relationships AS relations 3INNER JOIN wp_term_taxonomy AS taxes 4ON relations.term_taxonomy_id=taxes.term_taxonomy_id 5INNER JOIN wp_terms AS terms 6ON taxes.term_id=terms.term_id 7WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type like'product%'); 8 9DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type like 'product%'); 10DELETE FROM wp_posts WHERE post_type like 'product%';</code>
WARNING: this step will delete ALL media that is not attached to a post. So be cautious! It may be better to go through the media library and bulk delete by hand, to ensure you don’t delete something you’ll wish you’d kept.