How can I get the order shipping method id.?
For example 'flate_rate'.
Since WooCommerce 3 it is now complicated as everything has changed.
I have tried it with $order->get_data()
in a foreach loop but the data is protected.
How can I get the order shipping method id.?
For example 'flate_rate'.
Since WooCommerce 3 it is now complicated as everything has changed.
I have tried it with $order->get_data()
in a foreach loop but the data is protected.
If you want to get the Order Items Shipping data, you need first to get them in a foreach loop (for
'shipping'
item type) and to use WC_Order_Item_Shipping methods to access dataYou can also get an array of this (unprotected and accessible) data using the
WC_Data
methodget_data()
inside this foreach loop:To finish you can use the following
WC_Abstract_Order
methods related to "Shipping data", like in this examples: