Insert metafields in order email notifications

Highlighted
New Member
2 0 0

Could somebody please help me with the correct code to pull a metafields value into my order emails.

I am talking about metafields as in: http://docs.shopify.com/themes/liquid-variables/metafield

NOT meta seo tags

 

The codes I have tried are:

 {{ product.metafields.shortdesc[‘shortdescr’] }}

 {{ line.metafields.shortdesc[‘shortdescr’] }}

 {{ line.product.metafields.shortdesc[‘shortdescr’] }}

 

Within the following:

{% for line in line_items %}{{ line.quantity }}x {{line.title }}  {{ line.product.metafields.shortdesc[‘shortdescr’] }}  for {{ line.price | money }} each (sku: {{ line.sku }})  {{ line.line_price  | money_with_currency }}
{% endfor %}

 

If somebody could give me some advice it would be very much appreciated!

Thanks

 

0 Likes
Highlighted
New Member
1 0 0

So funny that you just posted this Hazel, I was dealing with this all day today without any positive results, so I'm interested in a solution here as well!

Thanks

0 Likes
Highlighted
Shopify Partner
1184 1 64

You can refer to line item properties like so:

line.properties['super-awesome-property']

So it would look like this:

{% for line in line_items %}{{ line.quantity }}x {{line.title }} {{ line.properties['shortdescr'] }} for {{ line.price | money }} each (sku: {{ line.sku }})  {{ line.line_price  | money_with_currency }}
{% endfor %}

 

www.bookthatapp.com ♥ www.searchifyapp.com ♥ www.productsassistant.com
0 Likes
New Member
1 0 0

I'm just adding to this thread because it's the first result that comes up when searching for "product metadata email notification shopify". The solution above didn't work for me, but in my use case where I have numerous Product level metafields under a specific namespace the following worked for me -

 

https://community.shopify.com/c/Shopify-APIs-SDKs/How-to-add-metafield-to-check-for-specific-product...

 

{{ line.product.metafields.namespace.key }}

0 Likes