Skip to content

Instantly share code, notes, and snippets.

@CapWebSolutions
Created June 3, 2021 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CapWebSolutions/c1b4175325ea95dc990b09258937f62b to your computer and use it in GitHub Desktop.
Save CapWebSolutions/c1b4175325ea95dc990b09258937f62b to your computer and use it in GitHub Desktop.
WooCommerce: Bulk Delete Orders / Products Super Fast
DELETE FROM wp_commentmeta WHERE comment_id IN ( SELECT ID FROM wp_comments WHERE comment_type = 'order_note' );
DELETE FROM wp_comments WHERE comment_type = 'order_note';
DELETE FROM wp_woocommerce_order_itemmeta;
DELETE FROM wp_woocommerce_order_items;
DELETE FROM wp_comments WHERE comment_type = 'order_note';
DELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'shop_order' );
DELETE FROM wp_posts WHERE post_type = 'shop_order';
DELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type IN ( 'product', 'product_variation' );
DELETE FROM wp_posts WHERE post_type IN ( 'product', 'product_variation' );
DELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'product' AND post_status = 'trash' );
DELETE FROM wp_posts WHERE post_type = 'product' AND post_status = 'trash';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment