How to include a link to tracking info in notification email?

Highlighted
Excursionist
80 0 13

When my customers receive a shipment notification email from me it currently asks them to click on a "View your order" button, where they then have to find the tracking link and click on it to track their package.

How can I modify this notification to instead include the tracking number itself as a clickable link right in the email?  aka "Track your package here:  UA630119419US"  

Here's a current version of a thank you email for a shipped item.  Note that no tracking info is provided in the actual email.

 

 

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
150 0 14

Hi, MD.

This is Martha from the Shopify team.

The function of adding a tracking link to notifications can be done by adding a tracking number and carrier to your order. This information will be accessible to your customer through the Shipping update template, if you choose to enable it. Settings > Notifications scroll down to Shipping, and click on Shipping update.

For more info on how to add tracking numbers to fulfilled orders click here, or to add while fulfilling an order, follow these steps

If you want to add this info to the order confirmation email, this would involve modifying the code of this order notification. Here are some resources that might help:

  • Basics on Editing Email Notifications.
  • Some of the editable properties available in your notifications are listed here, this link directly goes to the fulfillment properties 
  • A similar request was answered here, if you'd like to refer to this forum post.  

You might also find this blog post helpful if you (or anyone else reading) is interested in learning more about coding. 

Feel free to reach out to us for more help with your shop!

Best, 
Martha

0 Likes
Highlighted
Excursionist
80 0 13

Thank you, I believe this will solve my problem once I noodle it through.

Is there a way to test these emails in a sandbox evironment?  I'm aware of the "Preview" and "Send test email" optionis in the notificaitons modification sections of Shopify, but the difficulty is that without actually shipping anything no tracking information is created or included in the test emails, so I have no way of knowing if the changes I made to my templates are functioning properly.

0 Likes
Highlighted
Shopify Staff
Shopify Staff
150 0 14

Hey, MD

Martha, again. 

Noodle away. Customizing things can take a little research and trial and error. 

If you want to check out how the tracking info looks in an email, I would suggest using test orders (with your email details) so you can go through the whole process and enter in some tracking details! If you are working in your shop before making it live to customers, you might find using test mode on your payment gateway will help with this!

* Testing Shopify Payments
* More about Test Orders

Best of luck!
Hope this helps :)

Cheers,
Martha 

0 Likes
Highlighted
Shopify Partner
26 2 24

In the interest of helping people who find this question when Gogling "Shopify tracking link in shipment email", here's the code to make this magic happen:

{% for trackingUrl in fulfillment.tracking_urls %}
<a href="{{ trackingUrl | escape }}" class="button__text">Track Your Package</a>
{% endfor %}
1 Like
Highlighted
Shopify Partner
26 2 24

I'm not sure if this was the case back when OP posed this question, but as of Mar 2019, it doesn't seem like there's any compelling reason to include the carrier's own tracking link in any email.

 

The default email templates all send you to the order status page, which does a great job of showing shipment/fulfillment status for each item on the order status page. Buyers wanting more details can make it to the carrier's own status page by clicking the tracking # on the status page.

 

Selection_281.png

Shopify sends an email with a "Track my shipment" link when the shipment goes out for delivery. It also goes to the order status page.

Selection_282.png

In other words: If you do have a requirement to include the carrier's own link in an email, the code in my previous post will still achieve that, but I think you're probably best off with the default Shopify behavior and your own (branded) order status page.

0 Likes
Highlighted
Explorer
43 5 5

For anyone that still looking to figure this out,

paste this code in your shipping confirmation email:

{% if fulfillment.tracking_numbers.size > 0 %}
  <p class="disclaimer__subtext">
    <br/>
    {% if fulfillment.tracking_numbers.size == 1 and fulfillment.tracking_company and fulfillment.tracking_url %}
      {{ fulfillment.tracking_company }} tracking number: <a href="{{ fulfillment.tracking_url }}">{{ fulfillment.tracking_numbers.first }}</a>
    {% elsif fulfillment.tracking_numbers.size == 1 %}
      tracking number: {{ fulfillment.tracking_numbers.first }}
    {% else %}
      tracking number:<br />
      {% for tracking_number in fulfillment.tracking_numbers %}
        {{ tracking_number }}<br />
      {% endfor %}
    {% endif %}
  </p>
{% endif %}

As for placement, I suggest pasting the above code immediately below this:

<p>{{ email_emphasis }}</p>
            {% endif %}

After pasting, and before clicking Save,click the Preview button to see that you're happy with the way it looks.

 

Good luck!

1 Like