【问题标题】:Woocommerce shipping methods for orders in database数据库中订单的 Woocommerce 运输方式
【发布时间】:2014-09-25 17:44:29
【问题描述】:

我正在尝试获取特定订单的所有订单详细信息。

我一直在获取 shipping_method。

在早期版本的 woocommerce 中,我可以根据订单 ID 轻松找到保存在 wp_postmeta 表中的 shipping_method,但在较新版本的 woocommerce 中找不到。

虽然我发现运输方式与其他购物车详细信息一起保存在 wp_options 作为 selected_shipping_methods 。

我应该使用这个 selected_shipping_methods 还是将订单的 shipping_method 保存在其他地方?

如果需要更多信息,请询问。提前致谢

【问题讨论】:

    标签: wordpress woocommerce


    【解决方案1】:


    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

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 2018-04-27
      • 2019-02-03
      • 2019-12-18
      • 2018-04-18
      • 2021-02-27
      • 1970-01-01
      • 2018-07-27
      • 2018-06-26
      • 2021-02-01
      相关资源
      最近更新 更多