我正在尝试获取特定订单的所有订单详细信息。
我被困在获取 Shipping_method 上。
在早期版本的 woocommerce 中,我可以根据订单 ID 轻松找到 wp_postmeta 表中保存的 Shipping_method,但在较新版本的 woocommerce 中却找不到。
尽管我发现运输方式与其他购物车详细信息一起保存在 wp_options 中作为 selected_shipping_methods 。
我应该使用此 selected_shipping_methods 还是将订单的 Shipping_method 保存在其他地方?
如果需要更多信息,请询问。提前致谢
最佳答案
WooCommerce 根据订单 ID 将送货方式存储在“woocommerce_order_items”表中,其中 order_item_type 正在送货
您可以使用“WC_Order”类的函数“get_shipping_methods()”,如下所示
$order->get_shipping_methods()
其中 $order 将是“WC_Order”类的对象
您可以在此处获取有关此功能的更多信息。
http://docs.woothemes.com/wc-apidocs/source-class-WC_Order.html#375-382
希望这会有所帮助。
关于wordpress - Woocommerce 数据库中订单的运送方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25098561/