less than a minute read • Updated 2 hours ago
Email receipt Twig variables reference
The Twig variables available specifically in email receipt templates, plus the placeholders used to customize the email's subject, from, reply-to, and BCC.
Email receipt templates have access to everything available in the cart and checkout templates, plus the following email-specific variables.
Email-specific variables
Variable | Description |
|---|---|
| The number of days since the subscription in this email first failed, used for dunning reminder emails. |
| True if this email is for a normal transaction. |
| True if this email is for an expiring payment methods reminder, triggered by the dunning functionality. |
| True if this email is for a subscription that has just been canceled through the dunning functionality. |
| True if this email is for a subscription past-due reminder, triggered by the dunning functionality. |
Overridable placeholders
These values can be set to change the email’s behavior. Set them in the receipt text email template area (this applies whether or not you’re also using the HTML version):
Placeholder | What it controls |
|---|---|
| Sets the email subject. If set to an empty string, the email won’t be sent. |
| Sets the email’s |
| Sets the email’s |
| Sets the email’s |
Set these using Twig’s fc_output_data filter:
{% set custom_subject = 'custom email subject for order ' ~ order_id ~ ' shipping to ' ~ shipping_address.first_name %}
{{ custom_subject|fc_output_data('email_subject') }}
{% set custom_from = 'someone@example.com' %}
{{ custom_from|fc_output_data('email_from') }}
{% set custom_bcc = 'someone_else@example.com' %}
{{ custom_bcc|fc_output_data('email_bcc') }}
Notes
The Twig variables available in the receipt email subject setting are limited. To access variables like the customer’s first name, make the customization in the receipt text email template area instead.