3

How to get tracking information from order shipment in magento 2?

6
  • what you want to get from tracking info ? Commented Oct 24, 2018 at 11:49
  • All tracking info Commented Oct 24, 2018 at 11:51
  • take a look at vendor/magento/module-sales/view/frontend/email/shipment_new.html
    – Marcel H.
    Commented Oct 24, 2018 at 11:52
  • Please check my answer. Commented Oct 24, 2018 at 11:53
  • Is it working ? @JitendraPatel Commented Oct 25, 2018 at 8:58

1 Answer 1

5

You can get all tracking details using this code :

$tracksCollection = $order->getTracksCollection();

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

     echo $track->getTrackNumber(); // Tracking number
     // You can get other details here.

}

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.