Skip to content

Instantly share code, notes, and snippets.

@CapWebSolutions
Created June 3, 2021 13:40

Revisions

  1. CapWebSolutions created this gist Jun 3, 2021.
    2 changes: 2 additions & 0 deletions BulkDeleteAllOrderNotes.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    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';
    5 changes: 5 additions & 0 deletions BulkDeleteAllOrders.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    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';
    2 changes: 2 additions & 0 deletions BulkDeleteAllProducts.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    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' );
    2 changes: 2 additions & 0 deletions BulkDeleteAllTrashedProducts.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    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';
    2 changes: 2 additions & 0 deletions notes.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    ref: https://www.businessbloomer.com/woocommerce-bulk-delete-orders-products-super-fast/
    ref: https://www.businessbloomer.com/woocommerce-database-explained-how-it-works-and-where-to-find-data/