In this guide, we'll show you how to customize your email templates so that your customers receive the respective tracking link along with the shipping confirmation of their order.
Navigate to Settings → Shop → Email Templates to find a list of all email templates. Look for the template Entry delivery status: Shipped and click on Edit.
Scroll down to the Mail Text section and insert the following code in the Plain Text and HTML fields respectively, where you want the tracking link to appear. Here's an example for DHL:
In the Plain Text field:
{% for delivery in order.deliveries %}
{% for trackingCode in delivery.trackingCodes %}
https://www.dhl.de/de/privatkunden/dhl-sendungsverfolgung.html?piececode={{ trackingCode }}
{% endfor %}
{% endfor %}
In the HTML field:
{% for delivery in order.deliveries %}
{% for trackingCode in delivery.trackingCodes %}
Tracking: <a href="https://www.dhl.de/de/privatkunden/dhl-sendungsverfolgung.html?piececode={{ trackingCode }}">{{ trackingCode }}</a></br>
{% endfor %}
{% endfor %}
If you're using a different shipping service provider, replace the URL marked in bold above with the respective one.
For GLS:
https://www.gls-pakete.de/sendungsverfolgung?trackingNumber=
For UPS:
https://www.ups.com/track?trackNums=
For DHL Express:
https://www.dhl.com/de-de/home/tracking/tracking-ecommerce.html?submit=1&tracking-id=
For Swiss Post:
https://service.post.ch/EasyTrack/submitParcelData.do?formattedParcelCodes=
For DPD:
https://tracking.dpd.de/status/de_DE/parcel/=
For German Post:
https://www.deutschepost.de/de/s/sendungsverfolgung.html?piececode=
When generating a shipping label, the generated tracking number will automatically be stored in the order details under Details → Shipping → Track and trace codes. This variable, trackingCode, will later be inserted into the email.