I've created partially shipment functionality in magento2 now the problem is when i send the shipment email i got the every shipment traking id for that particular order but i want that particular shipment tracking id. but i dont know how can i do that. any help would be appreciate here i attach the code for the shipment email.

enter image description here

and here i attach the shipment email image


1 Answer 1


I suggest you try

$shipment = $objectManager->create('Magento\Sale\Mode\Order\Shipment')->load($shipmentId);
$tracksCollection = $shipment->getTracksCollection();
            foreach ($tracksCollection->getItems() as $track) {
                $trackNumber = $track->getTrackNumber();
                $carrierName = $track->getTitle();

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.