Magento 2 – How to Get Shipping Method Using Order ID

magento-2.1magento2object-managershipping-methods

I am trying to get the shipping method using Object Manager

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('Magento\Sales\Api\Data\OrderInterface')->load($orderid);

by doing var_dump on $order->getShippingAddress()->getData() i get no such thing as shipping method, from where i can get shipping method?
I am new to magento.

after referring to this link

Magento2: How to get shipping method in order using observer `sales_order_save_after`?

I don't know how to use sales_order_save_after if that's the only solution out there.

Best Answer

You can try below code to get shipping method.

$shippingMethod = $order->getShippingDescription();
$order->getShippingMethod();

It's getting the shipping method. Still facing any issue let me know.

Related Topic