How to Add Magento 2 Track Order Link to Shipment Emails

By default, Magento 2 shipment emails do not include any order tracking information. However, you can complement templates with an order tracking link and make boring confirmation emails more informative and customer-friendly. With Magento 2 Order Status Pro extension, you can easily add a Magento 2 Track Order link or a button to shipment emails that takes customers to a one-stop, personalized order tracking page.

Step 1. Add a Variable to the Shipment Email Template

In Magento 2 admin panel, go to Marketing -> Communications -> Email Templates, and then click Add New Template, or click on the existing template that is used for Stores -> Configuration -> Sales Emails -> Shipment -> Shipment Email Template  (Default Config) or Stores -> Configuration -> Sales Emails -> Shipment -> Shipment Email Template  for Guest (Default Config).

Step-by-step guide:

  1. In the Template Content field, click where you want to add the Track Order link.
  2. Click Insert Variable.
How to add Magento 2 Track Order Link/URL/Button to shipment emails 1

Step-by-step guide:

  1. Under Plumrocket / Shipping Tracking, find and insert the Shipping Tracking Url.
How to add Magento 2 Track Order Link/URL/Button to shipment emails 2

Step-by-step guide:

  1. This is the embedded Shipping Tracking URL variable that will add the order tracking link to your shipment emails.
  2. Click Save Template to save the changes.
How to add Magento 2 Track Order Link/URL/Button to shipment emails 3

Additionally, you can add styles and customize the appearance of the Order Tracking link. In the example below, you can find the variable wrapped in HTML so that it looks like a button in shipment emails, which is more convenient and visible to customers.

<div style="text-align: center">
    <a style="font-family: Arial, sans-serif; font-weight: bold; width: 220px; max-width: 100%; text-decoration: none; line-height: 1; font-size: 18px; background: #e14250; color: #ffffff; padding: 15px 10px; border-radius: 5px; display: inline-block; text-align: center; border: 1px solid #E45A66;"
       rel="noopener noreferrer"
       target="_blank"
       href="{{var pr_shipping_tracking_url}}">
        Track My Order
    </a>
</div>

In order to check what the link looks like, you need to create a test order and shipment, add a shipping tracking number and send a confirmation email.

Step-by-step guide:

  1. Here’s what the Magento 2 Track Order button looks like in shipment emails.
How to add Magento 2 Track Order Link/URL/Button to shipment emails 4

The Magento 2 Track My Order link/button takes users to an all-in-one order tracking page, provided by the Order Status & Shipping Tracking Pro extension. The page lists the order number, status, and all shipping details, including a carrier tracking number and package location details. Additionally, the page provides a visual list of purchased products.

How to add Magento 2 Track Order Link/URL/Button to shipment emails 5

Was this article helpful?