tousif
tousif

Reputation: 739

Woocommerce shipping methods for orders in database

I am trying to get all order details of a particular order.

I am stuck on getting shipping_method.

In earlier versions of woocommerce, I can easily find the the shipping_method saved in wp_postmeta table against the order ID, but not in the newer versions of woocommerce.

Though I find the shipping method being saved in wp_options as chosen_shipping_methods , along with the other cart details.

Should I use this chosen_shipping_methods or the shipping_method for an order is saved somewhere else?

If more info is needed just ask. Thanks in advance

Upvotes: 2

Views: 4813

Answers (1)

Domain
Domain

Reputation: 11808


WooCommerce stores shipping method in 'woocommerce_order_items' table against the order ID, for which order_item_type is shipping
You can use the function 'get_shipping_methods()' of class 'WC_Order', as

$order->get_shipping_methods()

where $order will be object of class 'WC_Order'

You can get more information of this function here.
http://docs.woothemes.com/wc-apidocs/source-class-WC_Order.html#375-382

Hope this will help.

Upvotes: 3

Related Questions