How do you delete all products from woocommerce

If you want to delete all your products from a WooCommerce installation in order to upload a brand new product list or catalogue then run the following code in the MySQL database.

DELETE p FROM wp_posts p WHERE p.post_type = 'product';

DELETE pm FROM wp_postmeta pm LEFT JOIN wp_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;

DELETE tr FROM wp_term_relationships tr INNER JOIN wp_term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.taxonomy != 'link_category' AND tr.object_id NOT IN ( SELECT ID FROM wp_posts );