Editing Email Templates
In Settings > Emails you will find all of your email templates. Click on one to open it and configure its settings, or edit the Template.
Click Here for all email settings.
Editing the Email Template
The Email Templates use HTML and PHP to generate the email. Making edits to the basic text in an email does not require programming knowledge. You can simply change the text in the Template and Save to update the verbiage.
The template editor is a WYSIWYG (What You See Is What You Get), which means it tries to display content as it would be shown in your email.
The editor also gives you options for applying formatting options through the tools provided. Such as changing the font color, size, embedding links, adding lists, inserting tables, and more.
Be careful pasting text into your template.
When you copy text from other sources to paste it within the editor, there is often extra HTML formatting brought over with it. That can cause issues in your template as the extra formatting starts to interfere with the template.
Paste your text into a basic text editing tool like Notepad to strip the formatting. Then copy the text from there to be pasted into the template without anything extra.
Editing HTML of your Email Template
Further edits can be made by changing the HTML structure of the Template. To see the HTML, you must click the <>
symbol on the WYSIWYG editor.
You can then view or edit the raw HTML of the template.
Variables and Conditions in Email Templates
Customizing email templates with PHP conditions and variables is meant for users who have experience in advanced templating.
Variables
Click Browse Variables to search through the PHP variables which are available to display in your template, or to use in conditions within the template.
You can search through the list for the variable you're looking for, then hit Copy📄.
The variable will be copied to clipboard like: {{var order.getShippingDescription()}}
or {{var store_phone}}
. It can then be pasted into your template to display the stored data.
Conditions
Zoey's email templating system supports a limited but useful set of conditions and control structures that allow you to handle dynamic content. Although it doesn't have the full range of capabilities that a general-purpose programming language would offer, you can still implement conditional logic based on Magento-specific variables and methods.
if
andelse
Conditions:
The email templating system supports basic if and else conditions. These conditions can check whether a variable exists, whether it equals a specific value, or if it’s true/false.
For example:
{{if bill_email.isPastDue()}}
Invoice Is Past Due
{{else}}
Invoice Is Ready to be Paid
{{/if}}
{{if order.getGrandTotal() > 100}}
You qualify for free shipping!
{{else}}
You do not qualify for Free Shipping.
{{/if}}
depend
Conditions:
The depend directive is a simplified conditional that checks if a variable is set or has a value. It’s typically used for checking whether optional fields like phone numbers, email addresses, or other store configuration data are available before displaying them.
For example:
{{depend store_phone}} Call Us: {{var store_phone}} {{/depend}}
- Comparison Operators
Zoey’s email template system allows you to use basic comparison operators in conditions:
==
Equality
!=
Inequality
>
Greater than and<
Less than
>=
Greater than or equal to and<=
Less than or equal to
For example:
{{if order.getGrandTotal() > 100}} You qualify for free shipping! {{/if}}
Text Comparisons for Order Shipping and Payment Methods
There are four methods you can use to compare strings to the Shipping and Payment Method in your email template conditions:
Checking for Specific Shipping Methods
The method order_checker.isShippingMethod()
checks if the order uses a specific shipping method, such as "free shipping" or "flat rate." Here’s how you can implement it:
{{if order_checker.isShippingMethod('freeshipping_freeshipping, flatrate_flatrate')}}
Free shipping or flat rate
{{else}}
Paid shipping
{{/if}}
Explanation:
The isShippingMethod()
method checks if the order's shipping method matches any of the provided values.
In this case, it is checking for "freeshipping_freeshipping" or "flatrate_flatrate".
You must compare to the Shipping or Payment Method's code.
Checking for Shipping Methods with a Partial Match
The order_checker.isShippingMethodLike()
method allows for checking if the shipping methods partially match the provided string.
{{if order_checker.isShippingMethodLike('free, rate')}}
Free or rate shipping method
{{else}}
No free or rate shipping method
{{/if}}
Explanation:
The isShippingMethodLike()
method checks if the order’s shipping method contains any substring from the provided list (in this case, "free" or "rate").
Checking for Specific Payment Methods
You can use the order_checker.isPaymentMethod()
method to check if the order uses specific payment methods like "checkmo" or "purchase order":
{{if order_checker.isPaymentMethod('checkmo, purchaseorder')}}
Checkmo or Purchase Order payment method
{{else}}
Other payment method
{{/if}}
Explanation:
The isPaymentMethod()
method checks whether the current payment method for the order matches one of the provided values (in this case, checkmo or purchaseorder).
Checking for Payment Methods with a Partial Match
The order_checker.isPaymentMethodLike()
method works similarly to the shipping counterpart but for payment methods:
{{if order_checker.isPaymentMethodLike('check, order')}}
Check or order payment method
{{else}}
No check or order payment method
{{/if}}
Explanation:
The isPaymentMethodLike()
method checks whether the current payment method contains a substring from the provided list, like "check" or "order."
Conclusion
These methods allow you to tailor the content on your platform based on the shipping and payment method used in the order. You can use specific checks for exact matches or more flexible checks using the "like" methods, which match based on substrings.
Updated 18 days ago