how to delete completed orders in woocommerce using a my sql query

Multi tool use


how to delete completed orders in woocommerce using a my sql query
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
. I can't view the completed orders from the back-end. It's getting blank. I have 7,823 Completed Orders
. I hope that's why I seen white page when I'm going to view the Completed Orders
.
WordPress Dashboard
7,823 Completed Orders
Completed Orders
Is there have a way to, That I can delete all Completed Orders
using MySQL query. So, that I can run it in PHPMYADMIN
.
Completed Orders
PHPMYADMIN
Have any suggestions.
WordPress questions about programming and administration are best asked on wordpress.stackexchange.com
– Linus Kleen
Jul 23 '14 at 7:37
@AndyHolmes This site was worked more than 3 years. We having this problem since yesterday. Alos, I took a backup from
Live Website
and create local site. It's working fine when I'm change the settings like memory limit
and stuff. When I reversed it. Same issue.– yeshansachithak
Jul 23 '14 at 7:41
Live Website
memory limit
Yeah but have you upgraded wordpress? If you have, that'll be why. It'll be a PHP error not a database problem. Seems silly to delete completed orders, especially if you have problems with orders in the future
– Andy Holmes
Jul 23 '14 at 7:41
@AndyHolmes thanks, I didn't update
WordPress or PHP version on my server
. Can you please advise me how can I track this issue?– yeshansachithak
Jul 23 '14 at 7:46
WordPress or PHP version on my server
3 Answers
3
Woocommerce orders are stored in the post
table, postmeta
table, woocommerce_order_items
, and woocommerce_order_itemmeta
tables. Various parts of an order are stored in different tables. addition to that the order status is managed through the taxonomies
which stores the order status list.
Anyone who is/will be writing this query have to write at least 5-6 queries minimum or
single large join query.
post
postmeta
woocommerce_order_items
woocommerce_order_itemmeta
taxonomies
So, my suggestion to you should uninstall WooCoommerce, if you don't have much larger product setup. To do this you can follow this link which will delete the data
I already did this before you post. But, I marked it as a answer. By the way, Don't do this. This is not a proper solution. But, for the time being I also did the same. :)
– yeshansachithak
Jul 31 '14 at 10:45
Ok, thank you :)
– WisdmLabs
Jul 31 '14 at 12:36
My solution would be just deleting all the orders(If you're moving from a shop with demo data to your new site). You can do this using following SQL-queries.
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'
you missed wp_postmeta
– Bret Weinraub
Aug 26 '15 at 12:11
Delete complete order must start as new. Get delete all choosen
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
have you checked to just see if there's PHP errors and that's why theres a white page? Usually the reason
– Andy Holmes
Jul 23 '14 at 7:36