Magento get shipment id from order


Magento get shipment id from order : Shipments are created against the order in magento. You can create multiple shipments against a simple order. If you want to load shipment created against a order you can get it using order object to get shipments of that order. Here is an example of how to get shipment id from order object.


Magento get shipment id from order

Syntax to get shipment details such as shipment id from order is as –

  • Load order
  • Get Shipment Collection

Magento get shipment collection

Magento get shipment id from order

$orderIncrementId = 902;
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
$shipmentCollection = $order->getShipmentsCollection();
foreach($shipmentCollection as $shipment){
$shipmentIncrementId = $shipment->getIncrementId();
}

The above example will load all the shipments created against the order 902.


Advertisements

Add Comment

📖 Read More