Magento 2 get Shipment id from Order Id
Magento 2 get Shipment id from Order Id– There can be multiple shipments against an order. Here in this tutorial, we are going to explain how to get shipment ids from order object.
Magento 2 get Shipment id from Order Id | Shipment Collection Example
You can get the shipment collection by order.
Magento 2 Get shipment Collection
Shipment Collection can be retrived by order here is an example –
Magento 2 get Shipment id from Order Id Example:
$orderId = 9877; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $order = $objectManager->create('\Magento\Sales\Model\Order') ->load($orderId); $shipmentCollection = $order->getShipmentsCollection(); foreach($shipmentCollection as $shipment){ $shipmentIncrementId = $shipment->getIncrementId(); } |
Thus you can get the shipments from order.
Advertisements