How can I get the shipment tracking information from shipment or order object in magento2. Following ways doesn't work for me.



To get the shipping tracking numbers, use the following code.

$tracksCollection = $order->getTracksCollection();

foreach ($tracksCollection->getItems() as $track) {

     $trackNumbers[] = $track->getTrackNumber();


This will return an array of all shipment tracking numbers.

| improve this answer | |

To get track collection object

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.