Email Templating Engine Guide

How to customize your experience email templates using our templating engine

Updated over a week ago

Experiences will send out emails to customers on your behalf. Your initial installation of the app came with a basic default email template that will display the information your customers need to know for their booking.

One of our top priorities is to keep your customer's journey through your experience on brand and in line with the rest of your business. To do this we've added the ability to customize email templates.

Templating Engine

The Experiences App uses a templating engine called Nunjucks to render the formatted data into the email templates. This engine comes with a host of built in functions to help make it easy for you to display and format your emails exactly the way you need to for your business. 

Additional Functions

In addition to the built-in Nunjucks functionality, we have provided some custom functions to help with DateTime formatting and a couple other common use cases. That functionality is detailed below. This list will most likely grow over time as we find more scenarios that need extensions on the built in functionality of Nunjucks.

Date

date(date, timezone, outputDateFormat, inputDateFormat)

Parameters:
date: DateTime String, can be piped in using the nunjucks pipe character displayed below
timezone: The timezone that the date should be displayed in
outputDateFormat: (optional) String format that the date should be displayed as
inputDateFormat: (optional) String format of the date of going into the function

Example:
Your experience starts at {{ booking.startsAt | date(booking.timezone, "YYYY-MM-DD HH:mm Z")

Output:
Your experience starts at 2019-04-23 13:30 PDT

Date Time Formatting Strings

DateTime strings can be formatted using the above date function and by using the standard date time formatting designators which are detailed here.

Pluralize

NOTE: This only works for English words at the moment 

Often times when dealing with quantities of things you'll want to display the correct pluralization of a word. i.e. 1 Ticket vs. 2 Tickets

We've provided a function called pluralize  which will help make it easier to display the correct pluralization of almost any english word you'd need.

pluralize(word, count)

Parameters:
word: The string that you would like to pluralize or de-pluralize
count: The number of units if 1 it will display the singular version, if greater than 1 it will display the plural version

Example:
You booked {{ quantity }} {{ "ticket" | pluralize(quantity) }}

Output:
You booked 2 tickets
-or-
You booked 1 ticket

Injected Data Objects

The Experiences App injects some data into each of the email templates similar to how Shopify injects data into your shop's liquid templates. You can then use these values to format and customize the templates. We've described each of the data objects below which you can access within the template.

Shop

This the data associated with the shop that this order is for. It contains some basic information and contact info about the shop which you can include in the email to a customer. 

shop.shopUrl
Type: String
The myshopify.com domain name that is associated and unique to your shop

shop.name
Type: String
The name that was given to your shop in the shop settings section of Shopify

shop.email
Type: String
The email that is associated with the shop. Generally used for internal shopify communication 

shop.customerEmail
Type: String
The email that is set in Shopify to be used in communication with the shop's customers

shop.moneyFormat
Type: String
The desired format for currency as designated in the shop settings in Shopify.

shop.ownerName
Type: String
The shop owners full name as designated in the shop settings in Shopify

shop.phone
Type: String
The shop's preferred telephone number as designated in the shop settings in Shopify

shop.timezone
Type: IANA Timezone string
The timezone that the shop exists in as designated in the shop settings in Shopify

shop.zipcode
Type: String
The zipcode that's associated with the shop based on the address set in shop settings in Shopify

shop.createdAt
Type: ISO DateTime
The date and time that the shop first installed Experiences App

shop.updatedAt
Type ISO DateTime
The date and time that the shop data was last updated

Order

Provides and overview of the order including when it was made and how much it was for. 

draft.order
Type: Boolean (true/false)
Indicates whether the current order is a draft order (for reservation experiences) or a regular order (for free and prepay experiences)

order.paidAt
Type: DateTime String
Date string indicating when the order was paid

order.fulfilledAt
Type: DateTime String
Date string indicating when the order was fulfilled

order.cancelledAt
Type: DateTime String
Date string indicating when the order was cancelled. Will be null if the order was not cancelled

order.createdAt
Type: DateTime String
Date string indicating when the order was created

order.totalPrice
Type: String
The total cost of the order including all line items (even non-experience line items) and tax.

Customer

Provides the contact information for the customer who made and paid for the order. It is possible for orders to be made without a customer record in Shopify so these values may be null. 

customer.email
Type: String
The email if present that the customer used when making the order

customer.firstName  
Type: String
The first name of the customer 

customer.lastName
Type: String
the last name of the customer

customer.phone
Type: String
The phone if present that the customer provided when making the order

Event

Contains details about the experience that was booked as well as additional information about each booking for the experience

event.name
Type: String
The name of the experience as set in the Experiences App edit event form

event.handle
Type: String
The URL for the experience located on the Shopify storefront
​ 
event.summary
Type: String
The brief description given to the experience in the Experiences App edit event form

event.description
Type: String
The long description given to the experience in the Experiences App edit event form

event.minLimit
Type: Number
The minimum number of units that a customer is allowed to purchase in a single order

event.maxLimit
Type: Number
The maximum number of units that a customer is allowed to purchase in a single order

event.location
Type: String
The address/location that was given to the experience in the Experiences App edit event form

event.paymentType
Type: String (One of "prepay", "reservation", "free")
The string indicating what type of experience this is, free, prepay, or reservation.

event.ticketedEvent
Type: Boolean (true/false)
Indicates whether the merchant has selected e-Ticketing for this experience (Currently this feature is still in development so this will always be false until we release the final version)

event.languageCode
Type: String
The official language code for the experience. Currently, Experiences App supports en-us  for english and es for spanish.

event.tags
Type: String list
The tags that have been assigned to this experience via the Shopify edit product page

event.publishedAt
Type: DateTime
The date and time that the experience was published to the storefront

event.createdAt
Type: DateTime
The date and time that the experience was created

event.updatedAt
Type: DateTime
The date and time that the experience was last updated

event.bookings
Type: Booking
The list of time slots that were booked for this experience and information about  the booking and attendees.

Booking

Contains details about each individual unit that was booked, what time slot it's for, and the associated details about the attendee.

booking.startsAt
Type: DateTime
The date and time that the booking was made for

booking.endsAt
Type: DateTime
The date and time that the booked time slot ends at

booking.variant
Type: String
The name of the variant that the booking was made for

booking.checkedInAt
Type: DateTime
The date and time that the attendee was checked in at if they've been checked in

booking.attendee.name
Type: String
The name of the attendee if a ticketed experience

booking.attendee.email
Type: String
The email of the attendee if a ticketed experience

booking.customOrderDetails
Type: CustomOrderDetail List
A list of any additional details collected in the order as configured in the Additional Details  section of the edit experience form.

booking.ticketedEvent
Type: Boolean
Indicates whether this booking was made for a ticketed event

booking.ticketUrl
Type: String
Once the e-Ticketing functionality is completed this will contain a link to view the order and ticket information for the booking

Custom Order Detail

customOrderDetail.label
Type: String
The name of the form field on the additional info form

customOrderDetail.value
Type: String
The value that the customer entered in the form field when filling out the additional info form


Did this answer your question?