laceyrod
(@laceyrod)
Automattic Happiness Engineer
Hi @etasigroup –
Thanks for reaching out.
Typically, when we see this happen, it means that someone may have cleared the trash but the order is still stuck in the database somewhere as you have mentioned in your case.
If you are looking to actually retain the order, you’ll need to piece together the information from the database and manually create a new one with that information.
Orders are a Custom Post Type (CPT), so they are stored in the wp_posts table. If you search the post_type field for ‘shop_order’, SQL will retrieve all orders.
Then, you must search the wp_postmeta table for all the records with post_id matching the id of the order post. Among the fields you will then find in the wp_postmeta table will be the entire shipping and billing addresses.
The order data will be stored in the woocommerce_order_items and woocommerce_order_itemmeta tables. These tables contain things pertaining to the actual product the customer bought.
The shop_order post entries have the post_id which matches order_id in woocommerce_order_items. The order_item_id in woocommerce_order_items matches the order_item_id in woocommerce_order_itemmeta.
I hope this helps.
Hi @etasigroup,
Since we haven’t heard from you in a while, we’re hoping that means you were able to get this resolved. I’m going to close this thread out now.
If you’re still having trouble, please open up a new topic and we’ll be happy to help out.
Take care