Woocommerce Order Technical Database Details

Woocommerce Orders are stored in the database as custom posts. The custom post type is named shop_order.

The WordPress post ID maps to the order ID and the post status describes the status of the order (ex: wc-pending). The traditional post content is left empty.

Details about the order, except for the items purchased, are kept as post meta. This includes things like billing information (name, street, etc), shipping address information, the order total, order currency, taxes and discounts.

The items ordered are kept in the wp_woocommerce_order_items. This is a simple database table that maps the product name to the order ID (aka the post.ID). Details about the product, such as the product price, quantity ordered, if it’s taxable, and product ID are kept in the wp_woocommerce_order_itemmeta database table.

Order Notes are stored as WordPress comments in the comments database table. The comment_post_ID links the comment to the order ID (aka the post.ID). These notes have a comment_type called order_note. The note text itself is stored as the comment_content in the database.

 

OnSiteWP