How can i access current woocommerce order shipping method id?

I have found method

$order->get_shipping_method() 

to access the name, but i want to retrieve the id instead of name?

Answers


thought i'd share how I solved this if someone runs into the same problem as me. I have WC_Order in the $order variable.

$order->get_items( 'shipping' );

This gives me an array with name, type, method_id, cost and taxes.


$shipping_method = @array_shift($order->get_shipping_methods());
$shipping_method_id = $shipping_method['method_id'];

Need Your Help

How to pass data to Modal ionic 2

javascript typescript ionic-framework modal-dialog ionic2

Hello guys Im trying to pass data from my device View to my Modal(device detail View) and bind it to my Modal so if i do (click)=openModal() the modal should open with the param which i clicked on....