---
title: "How to add Order tracking ID link in Shipping Email of Magento 2?"
url: "https://magecomp.com/blog/add-order-tracking-id-link-shipping-email-magento-2/"
date: "2019-04-01T16:43:27+00:00"
modified: "2025-02-21T12:36:17+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 306
reading_time: "2 min read"
summary: "Several Important aspects make an online business successful like creating and implementing a marketing strategy, managing social media, writing emails, balancing the books, managing and ordering i..."
description: "Several Important aspects make an online business successful like creating and implementing a marketing strategy, managing social media,&hellip;"
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How to Create Custom Sales Rule Condition in Magento 2"
    url: "https://magecomp.com/blog/create-custom-sales-rule-condition-magento-2/"
  - title: "Magento 2 Instagram Shopping: How to Sell on Instagram in 5 Steps"
    url: "https://magecomp.com/blog/magento-2-sell-on-instagram/"
  - title: "Magento 2: How to Add New Field at Order Total Block in Order PDF"
    url: "https://magecomp.com/blog/magento-2-add-new-field-at-order-total-block-in-order-pdf/"
---

# How to add Order tracking ID link in Shipping Email of Magento 2?

_Published: April 1, 2019_  
_Author: Dhiren Vasoya_  

![How to add Order tracking ID link in shipping email of Magento 2](https://magecomp.com/blog/wp-content/uploads/2019/04/How-to-add-Order-tracking-ID-link-in-shipping-email-of-Magento-2-1024x332.webp)

Several Important aspects make an online business successful like creating and implementing a marketing strategy, managing social media, writing emails, balancing the books, managing and ordering inventory and so on. And shipping may be at the lowest position on your list but its powerful enough to break your business. Because once customer orders the product, he or she is always wanting to know the shipping status until they receive their product hands on.

[![Magento version upgrade](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Version-Upgrade-CTA-2-2.webp)](https://magecomp.com/services/magento-upgrade-services/)
Sending such shipment tracking ID in your order email help your customer to track their shipment without contacting you or raising request. Unfortunately, Magento doesn’t bind [order tracking](https://magecomp.com/magento-2-order-tracking.html) code in the email that’s the reason why we have to code for adding shipment id in an email.
Here is the small piece of code that allows you to add Order tracking ID link in Shipping Email of Magento 2.

To do the same first we need to override this file:
**Vendor\magento\module-sales\view\frontend\templates\email\shipment\track.phtml**

by creating this path:
**app\design\frontend\Theme\Yourtheme\Magento_Sales\templates\email\shipment\track.phtml**

[![Magento 2 Speed & Performance Optimization Services](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Speed-Performance-Optimization-Services-CTA-1.webp)](https://magecomp.com/magento-performance-optimization.html)

Now add the below code using for each loop.

```
<!--?php $trackurl = ''; if($_item->getCarrierCode() === 'fedex'){
	$trackurl = 'https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber='.$_item->getNumber();
}elseif ($_item->getCarrierCode() === 'usps') {
	$trackurl = 'https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1='.$_item->getNumber();
}elseif ($_item->getCarrierCode() === 'ups') {
	$trackurl = 'https://wwwapps.ups.com/WebTracking/returnToDetails?tracknum='.$_item->getNumber();
}
?--><!--?= $block->escapeHtml($_item->getCarrierCode()) ?-->:
```

That’s it for today, Let us know if you are facing an issue while implementing this code by commenting below.

[![hyva theme development](https://magecomp.com/blog/wp-content/uploads/2025/02/hyva-theme-development-CTA-4.webp)](https://magecomp.com/services/hyva-theme-development/)

Happy Coding!


---

_View the original post at: [https://magecomp.com/blog/add-order-tracking-id-link-shipping-email-magento-2/](https://magecomp.com/blog/add-order-tracking-id-link-shipping-email-magento-2/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-08-21 18:51:59 UTC_  
