the Bento growth platform

How to add Shopify shipment information in your emails

Loads of people ask us for a way to add tracking information into a typical "Your order has shipped!" email.

Let's start with the snippet:

{% assign shipments = event.webhook.fulfillments %} {% for shipment in shipments %}
Tracking Number: {{ shipment.tracking_number }}
Learn more: {{ shipment.tracking_number }} {% endfor %}

This will render:

Tracking Number: 1234 Learn more: example.com/tracking?id=1234

So what are we doing here?

First, we dig into an event and grab the order fulfilment information. This is an array — not a standard object — so we have to iterate over it. In Shopify, an order can have many fulfillments.

So we go over each one (often there is just one) and output the number and the link.