where is a woocommerce order placed in wordpress database

MAK picture MAK · Jun 1, 2014 · Viewed 57k times · Source

I have a very simple question. but its bothering me a lot.

Can any one please tell me where does an order and every thing in it is stored in the database after it is placed from a WordPress woo-commerce website. To be more precise can anyone tell me how can I get my shipping address without using woocommerce classes like WC_Order class? I mean I need to get that data manually through my custom database queries, but I cant find the order and everything associated with it in my database? I know order is stored in the database as post in the wp-posts table but where is the rest of it i.e shipping address billing address etc etc? I hope I am not confusing anyone.

Best Regards,

MAK

Answer

Patrick McCormick picture Patrick McCormick · Feb 26, 2015

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.