Skip to main content
Write one order-confirmation template, then let every send fill it with that customer’s name, items, and total.

Prerequisites

Personalize the message

1

Write the template

Put this in an email block in , or create the template in code with the :
Four helpers are doing the work:datetime-format takes the timestamp, a strftime format, and a timezone. Passing profile.timezone means every customer reads the time in their own zone. Guard it with #if rather than default, since an empty string isn’t a date either.Anything prefixed with profile. comes from the stored profile. Everything else comes from data on the send.
2

Send the data it fills in

Verify

1

Read what arrived

2

Compare it against the data you sent

Open , find the requestId, and read the rendered message next to the data that produced it.
Check the delivered message, not the designer’s preview. The preview substitutes variables but doesn’t run helpers, so format and datetime-format can look wrong there and render correctly when sent.

Handle a missing value

A variable you only print is safe to omit: a missing single-brace variable renders as the literal {tax}, and a missing Handlebars var renders empty. The greeting’s default helper turns that empty render into “there” instead of a blank name. A variable a helper computes with isn’t safe. Send the template above without tax and add produces NaN, format throws, and the whole message fails with undefined is NaN. The status is UNDELIVERABLE, and nothing is delivered on any channel. The send still returns 202 with a requestId, so the only place this surfaces is the message status. Two helpers in this template need guarding, and they need different guards: The total above applies that guard:
To fail loudly on the printed kind too, turn on Throw on variable not found in the template’s Advanced settings. It catches a single-brace {tax} left in the rendered output, not a {{tax}} that rendered empty, so the default above is still what protects you. has the full behavior.
Branch on what you know with condition, which takes its operator as a string: {{#if (condition plan "==" "pro")}}Your Pro order ships free.{{/if}}