How can i access current woocommerce order shipping method id?

belfort1 picture belfort1 · Sep 30, 2014 · Viewed 16.5k times · Source

I have found method

$order->get_shipping_method() 

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

Answer

belfort1 picture belfort1 · Oct 3, 2014

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.