Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where does woocommerce store orders?

I'm looking in the sql db and I can see something that resembles orders inside wp_posts . However, I would expect them to be inside the tables beginning with wp_woocommerce.

Can anyone shed some light on this phenomenon?

Cheers

like image 746
Ke. Avatar asked Jul 31 '15 12:07

Ke.


People also ask

Where are orders stored WooCommerce?

WooCommerce orders are a Custom Post Type so they're located in the wp_posts table.

How are WooCommerce orders stored in database?

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).

Where are orders stored in WordPress?

Orders are a Custom Post Type (CPT), so they are stored in the wp_posts table.


2 Answers

In woocommerce orders are modelled as a custom post type so they are stored in wp_posts as you found. See WooCommerce taxonomies and post types for a list of the custom post types that woocommerce uses. Orders are stored as the type shop_order

Separate items within an Order are stored as separate records in the custom table woocommerce_order_items

like image 132
jacks Avatar answered Sep 19 '22 15:09

jacks


Updated plug-in version information 8/10/2018

Orders are a custom post type. From WooCommerce Post Types:

  • Shop Order (shop_order)

Orders live in the wp_posts table (post_type = 'shop_order'). More data is available by looking up the order's post_id in the wp_postmeta table.

In addition, from the WooCommerce GitHub Wiki Database Description

  • woocommerce_order_items – Stores line items which are associated with orders.
  • woocommerce_order_itemmeta – Stores meta data about order line items.

Currently the WordPress WooCommerce plug-in version is 3.4.x

like image 32
Matt M Avatar answered Sep 17 '22 15:09

Matt M