Adding Product Fields to Email Notifications
In this advanced guide, we'll show you how to include Custom Fields (metafields) in emails.
This article covers how to print Custom Field values in the order confirmation e-mail right under the product name.
STEP 1: Visit your Shopify Settings Page
STEP 2: Click on the Notifications section
STEP 3: Chose the e-mail type you want to customize.
STEP 4: Explore the e-mail template and find the place to have your custom field printed.
STEP 5: The e-mail template is table-structured. Find where the product title is displayed. See the screenshot below:
STEP 6: Paste in your code. In our example, we want to show the "Details" Custom Field we added to our products. See Theme Snippets and Developer Information About Each Field for how to get the exact code to paste in.
Exact placement is a bit tricky. See the screenshot above.
We recommend wrapping your field in a condition so it only prints if there's a value. Follow hte exmple code below.
{% if line.product.metafields.custom_fields.details!=blank %}
<span class=”order-list_item-fields”>{{ line.product.metafields.custom_fields.details}}</span>
{%endif%}
STEP 7: Save your Work & Test. Hit Save button and press Review on the top of the page to see how it is displayed.