Email Template Variables
Subscribe Pro email templates contain variables that are used to display particular values unique to your store and the Subscription Orders that your customers have placed. Its important to understand these variables so you can fully customize your templates.
Subscribe Pro uses the Twig PHP template engine to power email templates, so you can reference their documentation to learn the syntax and find useful filters, functions, and more.
Email templates should be surrounded by two curly brackets (e.g. {{ variable }}
). For variables containing dates/times, you can affix the variable with the |date('format')
filter to choose the format for your date, following the PHP date formatting rules. For example: {{ variable|date('M d, Y') }}
Top-level Email Template Variables
Variable Name | Variable Description |
---|---|
customerId | The Subscribe Pro customer ID for the subscription. |
platformSpecificCustomerId | Customer ID from external e-commerce platform linked customer record. |
customerServiceEmail | The email for your support as defined in the Subscribe Pro Environment settings. |
customerServicePhone | The phone number for your support in the Subscribe Pro Environment settings. |
magentoFrontendUrl | The url to the customer facing side of your Magento store |
magentoAdminUrl | The url to the administration panel of your Magento store |
storeLogoUrl | The url to the logo you upload in your Subscribe Pro Environment configuration. |
storeName | The name of your Magento store as defined in the Subscribe Pro Environment settings. |
templateImagesUrl | The root directory that holds your template related images (typically '/images' by default) |
fullName name | The customer's full name as filled out in their customer profile. Note: Either fullName or name may be used, as they contain the same information. |
firstName | The customer's first name, as filled out in their customer profile. |
middleName | The customer's middle name as filled out in their customer profile. |
lastName | The customer's last name as filled out in their customer profile. |
email | The customer's email address as filled out in their customer profile. |
customerSubscriptionCount | Count of all subscriptions for this customer. |
customerActiveSubscriptionsCount | Count of all active subscriptions for this customer. |
customerActiveSubscribedQuantity | Total quantity for all active subscribed product SKUs for this customer. |
subscriptionStatus | The current status of the subscription at the time of the email. |
subscriptionCreatedDateTime | The date and time the subscription was created. |
subscriptionNextOrderDate | The next shipping date for the product ordered in the subscription. |
subscriptionCardNumber subscriptionCardLastDigits | The last four digits of the credit card. |
subscriptionCardType | The card type (e.g. Visa, Master Card, etc.) |
subscriptionInterval | The time in between subscription shipments for this particular order as defined by the customer for the first subscription in the order. Note: individual products in the order may have their own intervals, stored in item.productInterval. This variable is meant to be used outside of the product loop. |
subscriptionScheduleName | Customer-friendly name of frequency interval or parameterized advanced scheduling rule. For example: Every 30 Days, Every 3rd Tuesday, etc |
subscriptionCouponCode | If there is a valid coupon code applied to the whole Subscription, it will be displayed with this variable code |
subscriptionMagentoShippingAddressId | The Magento Address ID for the shipping address. |
subscriptionMagentoBillingAddressId | The Magento Address ID for the billing address. |
shippingAddressFirstName | The first name used in the shipping address |
shippingAddressLastName | The last name used in the shipping address |
shippingAddressCompany | The company used in the shipping address |
shippingAddressStreet1 | The street address used for shipping |
shippingAddressStreet2 | The optional second line of the street address used for shipping |
shippingAddressCity | The city used for shipping |
shippingAddressRegion | The region (state) used for shipping |
shippingAddressPostcode | The zip/postal code used for shipping |
shippingAddressCountry | The country used for shipping |
Item-Specific Email Template Variables
The following variables can only be used inside the item loop. These variables will be different per subscription included in the order, whereas the above variables represent the entire order.
Here is an example from our default subscription_created
template:
{% for item in subscriptionProducts%}
<li style="margin-bottom:10px;">
<strong>Product Name: {{ item.productName }}</strong><br />
SKU: {{ item.productSku }}<br />
Quantity: {{ item.qty }}<br />
Prices: ${{ item.price }}<br />
Discount: {{ item.discountText }}<br />
</li>
{% endfor %}
In the above, the item
in item.productName
is defined in the for
loop. If you use a different variable name in place of item
, the variable name in all of the following variables will need to be changed accordingly.
Variable Name | Variable Description |
---|---|
item.subscriptionId | The subscription ID associated with the subscription product. |
item.productSku | The unique product number identifier of the item in the subscription order |
item.productName | The product name of the item in the subscription order |
item.productInterval | The interval used for this individual product. |
item.productNextOrderDate | The next order date of the subscription. |
item.productLastOrderDate | The date of the most recent order of the subscription. |
item.productExpirationDate | The expiration date of the subscription. |
item.scheduleName | Customer-friendly name of frequency interval or parameterized advanced scheduling rule. For example: Every 30 Days, Every 3rd Tuesday, etc |
item.qty | The number / quantity of items in the subscription order |
item.price | The price of 1 item in the subscription order |
item.discount * 100 | The discount applied (* 100) to the product item in the subscription order, in percent (%). This is separate and before the subscription wide coupon code is applied |
item.discountText | The discount text as shown on the product page |
item.is_discount_percentage item.isDiscountPercentage | A boolean variable for determining whether or not the discount for this product is a percentage or a fixed value. |
item.thumbnailUrl | The URL of the product thumbnail to be displayed with that item's details in the template. |
item.msrp | The MSRP field from Manage > Subscription Products > (edit) > Product Feed Data. |
item.salePrice | The Sale price field from Manage > Subscription Products > (edit) > Product Feed Data. |
item.isOnSale | Whether or not the (from Manage > Subscription Products > (edit) > Product Feed Data). This can be used to determine whether the item.SalePrice or item.price field should be used. For instance: {% if item.isOnSale %}{{ item.salePrice }}{% else %}{{ item.price }}{% endif %} |
item.fixedPrice | The fixed price set on a subscription, if any. |
item.useFixedPrice | Whether or not this subscription uses a fixed price. |
item.errorClass | The error class for a failed subscription. Example: soft_decline, magento, hard_decline, payment_card, technology. Note: An explanation for each class of error is available in our documentation about Automatic Ordering. |
item.errorClassText | The text explaining what an error class means. Note that this is not the actual error message, which is available in item.errorMessage. |
item.errorMessage | The actual error message explaining why a subscription failed. |
item.userDefinedFields | User-defined fields and values for subscription item. |
item.recurringOrderCount | Recurring order count for this subscription. The number of recurring orders which have already been processed. If an order was processed when the subscription was created, this initial order is NOT counted. |