woocommerce 在哪里下单?

where does woocommerce store orders?

我正在查看 sql 数据库,我可以看到类似于 wp_posts 中的命令的内容。但是,我希望它们位于以 wp_woocommerce.

开头的表格中

谁能解释一下这种现象?

干杯

在 woocommerce 中,订单被建模为 custom post type so they are stored in wp_posts as you found. See WooCommerce taxonomies and post types,用于 woocommerce 使用的自定义 post 类型列表。订单存储为 shop_order

类型

订单中的不同项目作为单独的记录存储在自定义 table woocommerce_order_items

wp_woocommerce_order_itemmeta
wp_woocommerce_order_items
wp_posts

根据您要查找的数据类型,您必须在不同的地方查找。如果您有 PHPMyAdmin,请尝试查找您要查找的数据。

更新插件版本信息 8/10/2018

订单是自定义 post 类型。来自 WooCommerce Post Types:

  • Shop Order (shop_order)

订单位于 wp_posts table (post_type = 'shop_order')。通过在 wp_postmeta table.

中查找订单的 post_id 可获得更多数据

此外,来自 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.

目前WordPress WooCommerce插件版本为3.4.x

WooCommerce 订单 "custom post" 它们存储在 "post_type" 下的 "wp_posts" -> “"shop_order"

如果您想 select 使用 sql 查询购买订单,您可以执行如下操作。

global $wpdb;
$results = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE post_type = 'shop_order'", ARRAY_A );

我最近手动恢复了订单数据,这是我找到的 table。

wp_posts //post_type = shop_order
wp_postmeta 
wp_woocommerce_order_items
wp_woocommerce_order_itemmeta

确保您的 order_id/order_item_id 引用在 postmeta 和 itemmeta 上是正确的。

您可以在 wp_posts table 中找到它们。

在 PhpMyAdmin 中:

单击wp_poststable,然后单击SQL选项卡和运行以下查询,假设wp_posts 是你的 table 姓名:

Select * from wp_posts where post_type='shop_order'

那么您就拥有了有关 woocommerce 订单的所有数据

单击 "Show all" 复选框

搜索 "completed" 以获取已完成的订单