Email Template Elements
You can use these proprietary elements to render order-specific information and simplify the editing process. To access the elements, navigate to Settings > Customer Emails and select the applicable subpage.
Logical Evaluation Elements
Logical Evaluation Elements conditionally display certain sections of content within a notification. These let you include specific text, HTML, or shared snippets conditionally if a specific product is in the order.
When using conditional comparisons, make sure to use double quotation marks around the operator in your expression.
List of Logical Evaluation Elements
- {{#each}}:Requires an object reference (e.g., order.items). For each product included in the reference, this command applies all embedded objects up to the closing {{/each}} tag.
- {{#each order.items}} {{display}} {{/each}}
- {{#if}}: Conditional evaluation for use in Boolean expressions. You can use {{#if}} with object references to control when specific behavior occurs, or when specific content appears in the messages.
- In the example below, if the fulfillment action is a license key, the product’s display name is rendered in place of the {{display}} variable, and the license key is rendered in place of the {{license}} variable. If the fulfillment action is not a license key, nothing between this {{#if}} and its closing {{/if}} tag is rendered.
{{#if license}}
{{display}}: {{license}}
{{/if}}
- In the example below, if the fulfillment action is a license key, the product’s display name is rendered in place of the {{display}} variable, and the license key is rendered in place of the {{license}} variable. If the fulfillment action is not a license key, nothing between this {{#if}} and its closing {{/if}} tag is rendered.
- {{#iff}}: Conditional evaluation used in comparisons, such as checking for a specific string variable or value, and reacting based on the value found. You can optionally use an {{#else}} tag to handle all other outcomes.
- The example below would be implemented in an {{#each order.items}} loop and check whether the associated product path is example1. If so, a shared snippet named Example1AP is inserted. Otherwise, a shared snippet named productAP is applied.
{{#iff product “==” “example1”}}
{{>Example1AP}}
{{else}}<
{{>productAP}}
{{/iff}}
- The example below would be implemented in an {{#each order.items}} loop and check whether the associated product path is example1. If so, a shared snippet named Example1AP is inserted. Otherwise, a shared snippet named productAP is applied.
Object References
You can include references to order or subscription-related elements in the email notification, such as:
- The list of products in a specific order
- The customer’s name and email address
- License keys issued for an order
To incorporate these references into the template, insert a variable consisting of the curly brackets and the object’s name. For example, including {{order.reference}} in the body of your notification renders the Order Reference Number in the email notification.
The double ‘handlebar’ {{ }} format used to insert object reference variables also causes all characters to be HTML escaped. If your product names include certain punctuation (such as ‘ ), you should use triple ‘handlebars’ {{{ }}} instead.
List of Object References
The following list identifies some of the order objects that you can include in your notification template. Each object is preceded by order.
- to: email address to which the notification message is sent
- replyTo: your reply email address (typically the customer service email address) as configured under Settings > Store Settings > General > Reply-To Email.
- language:2-character ISO language code for the language in which the transaction was processed (e.g. “en”)
- reference:order reference number
- account.url:URL for the customer-facing Account Management page associated with this customer
- live:Boolean; indicates whether the order was a live or test order
- currency: 3-character ISO code of the currency in which the transaction was processed
- total:Number; the total price paid by the customer, without currency
- totalDisplay:the tidal price paid by the customer, including the currency
- tax:Number; sales tax or VAT amount paid by the customer (if any)
- taxDisplay:sales tax or VAT amount paid by the customer (if any)
- subtotal: subtotal of the order before sales tax or VAT is added
- subtotalDisplay: subtotal of the order before sales tax or VAT (if any), including the currency
- account: customer’s account ID
- discount:amount of the discount applied to the order (if any)
- discountDisplay:amount of the discount applied to the order, formatted to include currency
- discountWithTax:Number; amount of the discount applied to the order (if any) including VAT or sales tax
- dicsountWithTaxDisplay: discount amount applied to the order (if any) including VAT / sales tax, and the currency
- invoiceUrl:URL for the customer’s invoice transaction
- billDescriptor: transaction description that appears on the customer’s payment account (EX: FS * fsprg.com)
- payment.type: customer’s payment method
- payment.cardEnding: last 4 digits of the card number associated with the order
- tags:renders the values for order-level custom tags associated with the purchase (such as Custom Orders and orders created via the POST /orders)
- customer.company: company name entered by the customer (if any)
- customer.email: customer’s email address
- customer.first:customer’s first name
- customer.last:customer’s last name
- customer.phone: phone number entered by the customer, if any
- address.addressLine1:First line of the customer’s address for orders with a physical product or required shipping address
- address.addressLine2: Second line of the customer’s address (if any) for orders with a physical product or required shipping address
- address.city:customer’s city for orders with a physical product or required shipping address
- address.region:customer’s state, province, or region for orders with a physical product or required shipping address
- address.country: customer’s country for orders with a physical product or required shipping address
- address.postalCode:customer’s postal code for orders with a physical product or required shipping address
- order.items:Array; consists fields of product information for each product included in the transaction
- product:product path for the current order item
- quantity:Number; quantity purchased of the current order item
- display:display name for the current product
- subtotal: Number; subtotal for the current order item
- sku: sku (if any) from the product record of the current order item
- attributes: custom attributes (if any) from the product record for the current order item. Enter the key name of the product attribute that you want to appear. The corresponding value will be rendered in the email messages.
- discount:Number; the discount (if any) applied to the current order item without the currency indicator. This is only valid in the context of {{#each order.items}}.
- discountDisplay: the discount applied to the current order item, including the currency.
- subscription.id: the subscription ID associated with the current order item. This is only valid in the context of {{#each order.items}}.
- coupon: the coupon code applied to the order, if any. This is only valid in the context of {{#each order.items}}.
- fulfillments: Array; consists of fulfillment-related fields applicable to the current products. Use a nested loop called ‘this’ within the {{#each.fulfillments}}.
- type:current type of fulfillment action for the product. Only valid in the context of {{#each fulfillments}}{{#each this}}.
- display:display name indicating the type of the current fulfillment action for the current product. Only valid in the context of {{#each fulfillments}}{{#each this}}.
- license:license key (if any) issued for the current fulfillment action, for the current product. Only valid in the context of {{#each fulfillments}}{{#each this}}.
- size:Number; size of the download file associated with the current fulfillment action, for the current product, in bytes. Only valid in the context of {{#each fulfillments}}{{#each this}}.
- file:download URL for the file associated with the current fulfillment action, for the current product. Only valid in the context of {{#each fulfillments}}{{#each this}}.
- order.support.contactName:your support contact name, as configured in Settings > Store Settings > Support Contact > Support Contact Name
- order.support.contactEmail: your support contact email address, as configured under Settings > Store Settings > Support Contact > Support Contact Email
- order.isRebill: Boolean; indicates whether or not the transaction was processed as an automatic rebill on an existing subscription. New orders placed directly by customers have a value of false for this item.
Shared Snippets
In the FastSpring App, navigate to Settings > Customer Emails > Shared Snippets to access available snippets for you to customize.
Shared snippets are self-contained elements that can be used and layered in notifications. For example, inserting the {{>header}} tag allows you to create a message header with images, links, and company information that you can use in multiple notification templates without having to recreate it in each one. You can also embed other snippets within {{>header}}. Use the Edit command below any snippet to modify the contents (including the name) of that snippet. If you make future changes to shared snippets, all notifications that contain the snippet will be updated automatically. The Delete command permanently deletes a snippet.
List of Shared Snippets
- {{>border-style}}: Specifies the border width, type and color. You can use this in a border attribute in place of entering inline styling.
- {{>font}}: Specifies a series of font families; you can use this in a font-family attribute place of a list of font families.
- {{>footer}}:Provides a block of HTML and CSS, with translations and other shared snippets, designed to render a professional-looking footer for use at the bottom of your templates.
- {{>header}}: Provides a block of HTML and CSS, with translations and other shared snippets, designed to render a professional-looking header for use at the top of your templates.
- {{>header-background-color}}: Specifies the hex value of a color (#30363d by default) that is used in the {{>header}} snippet, by default, to color the header background. You can also use this in any color attribute in your template, or another shared snippet.
- {{>logo}}:Specifies the URL of a logo file. You can use this in the src attribute of an img element in your template or in another shared snippet. For best results, we recommend using a logo no wider than 275 pixels. The default logo image is 143 x 35 pixels.
- {{>store-title}}: A string of text that identifies the name of your Store. The snippet appears within the {{>text-header}} snippet by default.
- {{>table-header-color}}: Specifies the hex value of a color that is used in the template of the Default Order Receipt notification and the {{>footer}} snippet, by default. You can also use this in any color attribute in your template, or in another shared snippet.
- {{>text-header}}:Provides a block of text designed to render a header for use at the top of the Text portions of your template.
- {{>text-footer}}: Provides a block of text designed to render a footer for use at the bottom of your templates.
Create a New Shared Snippet
-
In the FastSpring App, navigate to Settings > Customer Emails > Shared Snippets.
-
Click Add Snippet in the top, right corner of the page. The Shared Snippets popup appears.
-
In the Snippet Tag field, enter the name you wish to use to reference this Snippet elsewhere. Make sure the name is only composed of letters, numbers, and dashes (no brackets, carrots, or punctuation). The brackets and the > symbol are automatically added to the name you have entered when you save the snippet.
-
In the Snippet Text / HTML Value field, enter the contents of the snippet. These will replace the Snippet Tag entered above when notification templates or other snippets are processed.
-
Click Add to save the new Snippet. A card appears on the list of shared snippets.
Translations
In the FastSpring App, navigate to Settings > Customer Emails > Translations to edit translated text in your customer notifications.
You can enter a placeholder variable in your notifications template that is automatically replaced by another predefined element when FastSpring sends the notification. On the Translations page, there is a unique set of defined snippets. When you include the snippet, FastSpring detects the language used for the order to replace the phrase with the corresponding translation. For example, if you include {{translate “Total”}} in the body of your notification, and a customer selects Spanish as their language at checkout, the value you enter in the Total= entry on the Translations page appears in the email notification.
The Default Order Receipt notification and some default shared snippets use a variety of translations for which FastSpring has supplied the translated text. If you create any additional translations, be sure to enter the translated text in each language, as necessary.
Enter Translated Text
-
In the FastSpring App, navigate to Settings > Customer Emails > Translations.
- The red exclamation mark indicates that there are phrases awaiting translation in 1+ languages.
-
Select the language for which you want to enter a translation. In the applicable text area, enter the translation following the = sign.
-
Save your changes.
After you save a translation, it will appear in the Translations page, and FastSpring can apply the translation to emails where you add it.
Add New Words or Phrases for Translation
To add new words or phrases for translation to your email template, enter {{translate “ “}} with the word or phrase in between the quotation marks.
For example,{{translate “Be sure to check out our blog at}} instructs FastSpring to search for translations on the Translations page. FastSpring will apply your custom translation of this phrase for each language you translated it in.
Updated 10 months ago