In this article we will learn how to use custom HTML email templates with Shopify.
When you set up a Shopify store they automatically send a handful of emails out of the box for orders, shipping, customer support and notifications. The default email templates that Shopify provide look pretty good. Although there are a number of reasons you’re going to want to customize these.
You’ve just got yourself some new HTML email templates. You’re going to use templates that have inlined CSS so you know they work across all major email clients. They contain some images like your logo or social media icons.
Settings
-> Notifications
Order confirmation
as an examplereceipt-inlined.html
as an example) in your favorite editor as well so you have this side by side with the Shopify template for referenceShopify provides a files feature where you can upload images. This is your CDN and where all your files will be hosted.
img/logo.png
becomes something like //cdn.shopify.com/files/1234/logo.png
This is going to be the bulk of the task. Referencing the original Shopify template you’re going to copy/paste the various liquid variables and logic over to your new email template.
{{ order_name }}
for
statement for your list of items {% for line in line_items %}
Here are some code samples.
{% for line in line_items %}
<tr>
<td
style="font-family: sans-serif; font-size: 14px; vertical-align: top; border-bottom: 1px solid #eee; margin: 0; padding: 5px;"
valign="top"
>
{{ line.product.title }}
</td>
<td
class="receipt-figure"
style="font-family: sans-serif; font-size: 14px; vertical-align: top; border-bottom: 1px solid #eee; margin: 0; padding: 5px; text-align: right;"
valign="top"
align="right"
>
{{ line.line_price | money }}
</td>
</tr>
{% endfor %}
{% for line in tax_lines %}
<tr class="receipt-subtle" style="color: #aaa;">
<td
style="font-family: sans-serif; font-size: 14px; vertical-align: top; border-bottom: 1px solid #eee; margin: 0; padding: 5px;"
valign="top"
>
{{ line.title }}
</td>
<td
class="receipt-figure"
style="font-family: sans-serif; font-size: 14px; vertical-align: top; border-bottom: 1px solid #eee; margin: 0; padding: 5px; text-align: right;"
valign="top"
align="right"
>
{{ line.price | money }}
</td>
</tr>
{% endfor %}
Some liquid variables you might want to use.
{{ order_name }}
{{ shop.url }}
{{ line.image }}
{{ line.quantity }}
{{ discount_title }}
{{ subtotal_price }}
{{ stotal_price | money_with_currency }}
{{ shipping_address | format_address }}
{{ shop.email }}
{{ transaction.payment_details.credit_card_last_four_digits }}
At this point copy/paste your email template code over to Shopify.
Like I mentioned before, you can edit the HTML in the Shopify form, although I have found it much easier to manage this outside of Shopify using my own editor.
Shopify provides two testing methods. Preview in the browser and email yourself. Try both until it looks good.
Receive email design content like this to your inbox.
No spam. Just related email content.