Magento get Tracking number from order


Magento get Tracking number from order : Tracking number in magento are used basically to track the orders. You can get tracking number from magento order_shipment_collection. Pass order object to get the shipment of the order in sales order_shipment_collection. Here we are going to explain how to get tracking number from magento order object.


Magento get Tracking number from order

Here is an example how to get tracking numbers from order object.

Magento get Tracking number from order

$order = Mage::getModel('sales/order')->loadByIncrementId($orderid);
$shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection')
            ->setOrderFilter($order)
        ->load();
        foreach ($shipmentCollection as $shipment){
            foreach($shipment->getAllTracks() as $tracknumber)
            {
                $trackingnumbers[]=$tracknumber->getNumber();
            }

        }

The above example will give traking numbers generated in magento.

Note : This will give shipment increment id not actual tracking number.

User Ans/Comments

📖 Read More


Advertisements