I need to get a tracking number which resides in sales_shipment_track for each item in an order. Right now I am iterating all items of an order.

foreach ($_order->getAllItems() as $item) {
  echo $item->getTrackNumber();

This didnt work. How to get a tracking number and its title i.e, FEDEX so that I can know which carrier is that tracking number.

1 Answer 1

         $tracksCollection = $order->getTracksCollection();

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

          echo $track->getTrackNumber(); // Tracking number

  • How can i do it using query with order id and get tracking number for all items under hat element, as i am iterating for items with <?php foreach ($orderInfo->getAllVisibleItems() as $item): ?> this.
    – summu
    May 23, 2019 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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