I want to delete completed all orders in woocommerce by using a single my sql query. Because, I\'m having a problem with my WordPress Dashboard
UPDATE wp_posts
SET post_status = 'trash'
WHERE post_type = 'shop_order'
AND post_status = 'wc-completed'
This code does not completely eliminate the system or base of Order data, send it to the trash.
Woocommerce > Orders > Trash and click Empty Trash.
- wc-completed
- wc-pending
- wc-processing
- wc-on-hold
- wc-cancelled
- wc-refunded
- wc-failed
And you are specifying them inside the clause IN ('status')
UPDATE wp_posts
SET post_status = 'trash'
WHERE post_type = 'shop_order'
AND post_status IN ('wc-pending', 'wc-processing', 'wc-on-hold', 'wc-cancelled', 'wc-refunded', 'wc-failed')