Last active
October 17, 2023 07:22
-
-
Save mPanasiewicz/5127b23b214597772d4f3ae9fc8c6fbd to your computer and use it in GitHub Desktop.
Woocommerce deleton SQLs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This query deletes all users which have been created through woocommerce sign up form | |
DELETE from wp_users where wp_users.ID not in ( | |
SELECT meta_value FROM wp_postmeta WHERE meta_key = '%_customer_user' | |
) AND wp_users.ID not in (select distinct(post_author) from wp_posts); | |
# This query deletes all woocommerce orders | |
# [IMPORTANT] QUERY ORDER MATTERS [IMPORTANT] | |
DELETE FROM wp_woocommerce_order_itemmeta; | |
DELETE FROM wp_woocommerce_order_items; | |
DELETE FROM wp_commentmeta WHERE meta_id IN ( SELECT comment_id FROM wp_comments WHERE comment_type = 'order_note' ); | |
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'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment