Using handlebars helpers in your templates

Overview


Handlebars helpers are powerful tools that allow you to customize content in your email templates. This guide introduces you to various handlebars helpers and will provide the flexibility you need for personalized emails.


Formatting helpers

Here are the list of formatting helper that you can use:

or
uppercase
formatDate
formatTimeslot
formatDatePeriod
formatPrice
formatPhone
formatAddress
ifEquals
ifNull

Examples:

uppercase

Your invoice #{{uppercase invoice.sid}}

Example of usage:

ifEquals

Compares two values for equality. Use this for conditional statements based on value equality.

{{#ifEquals site.title 'Central'}}
[Check our new promo available](https://example.org/test)
{{/ifEquals}}

formatPhone

format phone without spaces (useful for links):

[Call us](tel:{{formatPhone site.phone}})
formatAddress

format address without line returns (useful in tables)

|  |  |
| - | - |
| Address | {{formatAddress user.address}} |

formatDate

format the raw date into a more user-friendly format.

Created date: {{formatDate invoice.created}}

Example of usage:



Valet specific helpers

Here are the list of helpers specific to valet that you can use:

// valet
ifIsCollectionOnly
ifIsDeliveryOnly
ifIsDeliveryAndCollection
ifCollectImmediately
ifCollectLater
ifHasItemsToCollect
ifHasItemsToDeliver
ifHasEmptyBoxes
ifHasBulkyItems


Invoices specific helpers

Here are the list of helpers specific to valet that you can use:

// invoices
ifInvoiceFailed
ifInvoicePaid
ifCreditNote

Examples:

ifCreditNote

{{#ifCreditNote}}
### Your credit note
{{else}}
### Your order
{{/ifCreditNote}}
the else part is optional, you can also write
{{#ifCreditNote}}
### Your credit note
{{/ifCreditNote}}
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us