Hello @cc05
Got it â if youâre using a product metafield, no worries! You can definitely display the metafield value in your email template. By default, though, we canât directly fetch product metafields on the Thank You page. So, youâll need to pass that metafield value as a cart line item property first.
Hereâs how you can do it:
1. Add the metafield value to your product form
Locate your product form in the buy-button.liquid file (if youâre using the Dawn theme). The form will look something like this:
{%- form 'product',
product,
id: product_form_id,
class: 'form',
novalidate: 'novalidate',
data-type: 'add-to-cart-form'
-%}
Inside this form, add the following code:
{% if product.metafields.custom.ship_out_date %}
{% endif %}
Save the file once youâve added this.
2. Update your email template
Now, open your email template and search for line.product â youâll find product title-related code multiple times. After the title section, insert this code to display the Ship Out Date:
{% if line.properties["Ship out date"] %}
Ship Out Date: {{ line.properties["Ship out date"] }}
{% endif %}
If youâre specifically editing the Order Confirmation Email template, find this line:
{{ line_title }}
And paste the Ship Out Date code right after that .
Note: Please use the metafield name that you have created on your admin side.
If you follow these steps, then you can easily showcase the metafield value on your email template.
Thanks