Email Templates Overview
This article provides an overview of BigCommerce's transactional email templates and API.
Editing
To edit transactional email templates in a store's control panel, log in (opens in a new tab) and navigate to Marketing › Transactional Emails (opens in a new tab).
Use Handlebars expressions to localize email templates and access dynamic data (like a customer's first name in an order email).
<p>{{ lang 'hello' name=order.customer_name }}. Below are the products you ordered.</p>
{{#each order.products}}
<tr>
<td style="padding:5px; font-size:12px; border-bottom:solid 1px #CACACA"><strong>{{ name }}</strong></td>
<td style="padding:5px; font-size:12px; border-bottom:solid 1px #CACACA" width="100" align="center">{{#if sku }}{{ sku }}{{else}} {{/if}}</td>
<td style="padding:5px; font-size:12px; border-bottom:solid 1px #CACACA" width="100" align="center">{{ quantity }}</td>
</tr>
{{/each}}
Saving an email template that exceeds 65,536 characters returns an "Email body too large" error message and truncates extra characters.
API
To manage transactional email templates programmatically, use the Email Templates API. For example, to get a list of email templates, send a GET
request to /v3/marketing/email-templates
.
GET https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/marketing/email-templates
X-Auth-Token: {{ACCESS_TOKEN}}
Accept: application/json
To update an email template, send a PUT
request to /v3/marketing/email-templates/{template-name}
.
PUT /stores/{{STORE_HASH}}/v3/marketing/email-templates/account_reset_password_email
Host: api.bigcommerce.com
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json
{
"type_id": "account_reset_password_email",
"body": "<!DOCTYPE html> <html lang=\"en\"> <head> <meta charset=\"UTF-8\"> <title>Title</title> </head> <body> <p> {{lang \"reset_password\" name=store.name}} </p> <br/> <br/> <a href='{{account.reset_password_link}}'> {{account.reset_password_link}} </a> </body> </html>",
"translations": [
{
"locale": "en",
"keys": {
"reset_password": "To change your customer account password at {name} please click this link or copy and paste it into your browser:"
}
}
],
"subject": "Reset your password at {{store.name}}"
}
Overrides
Pass in a channel's ID using the ?channel_id=
query parameter to create a channel-specific override for a transactional email template.
PUT https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/marketing/email-templates?channel_id=123
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json
{
"type_id": "account_reset_password_email",
"body": "<!DOCTYPE html> <html lang=\"fr\"> <head> <meta charset=\"UTF-8\"> <title>Title</title> </head> <body> <p> {{lang \"reset_password\" name=store.name}} </p> <br/> <br/> <a href='{{account.reset_password_link}}'> {{account.reset_password_link}} </a> </body> </html>",
"translations": [
{
"locale": "fr",
"keys": {
"reset_password": "Pour modifier le mot de passe de votre compte client à {name}, veuillez cliquer sur ce lien ou le copier et le coller dans votre navigateur:"
}
}
],
"subject": "Réinitialisez votre mot de passe sur {{store.name}}"
}
Omit ?channel_id
to interact with global email templates.
Resources
- Email Template API Reference
- Email Template Handlebars Reference
- Customizing Email Templates (opens in a new tab)