Using Shopify metafields - custom fields in order notifications

Modified on Thu, 22 Oct, 2020 at 4:47 PM

Sample code

{% for line in line_items %} 
{{ line.product.metafields.namespace.key }} 
{% endfor %} 

Examples of Liquid drops to use in e.g. a Shopify notification template: 


{{ order.metafields.c_f.purchase_order_reference }}
{{ order.customer.metafields.c_f.id }}
{% for line in line_items %}
 {{ line.product.metafields.c_f.gift_option}}{{line.variant.metafields.c_f.washing_instructions }}
{% endfor %}
This example only applies to Shopify's internal notification templates. If you want to use the Order Printer app, metafields will not be available, so another approach is needed - please see this article from Shopify

You may find more detail about line item at https://shopify.dev/docs/themes/liquid/reference/objects/line_item




Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article