Shopify themes, liquid, logos, and UX
Hi!
I have read all the treads about this but cant make it work :))
I have an produkt metafields, witch is named: custom.event_info_test
I want to show this in the order confirmation email... But how?
Solved! Go to the solution
This is an accepted solution.
You can access product metafields with the line.product.metafields variable.
Example:
{% for line in line_items %}
<p>{{ line.product.metafields }}</p>
{% endfor %}
To show a specific metafields, you can use this variable: {[ line.product.metafields.NAMESPACE.KEY }}
So, assuming "custom" is the namespace and "event_info_test" is the key, you could access that metafield with this variable:
{[ line.product.metafields.custom.event_info_test }}
Reference docs:
- https://help.shopify.com/en/manual/orders/notifications/email-variables
- https://shopify.dev/docs/api/liquid/objects/metafield
Hi @annenetmine,
To show product metafield value in your order confirmation email you need to edit the "Order Confirmation" template.
To access "Order Confirmation" template follow these steps -
Now, here in the template you can add you metafield to be displayed.
For editing the liquid code, here is reference video link to edit printing slip template to display custom field value of the product: https://www.youtube.com/watch?v=aMN49-AZLYI
This will give you an idea of how to edit template and use liquid variables.
Please let me know if more details are needed.
Thanks & Regards,
Vivek
This is an accepted solution.
You can access product metafields with the line.product.metafields variable.
Example:
{% for line in line_items %}
<p>{{ line.product.metafields }}</p>
{% endfor %}
To show a specific metafields, you can use this variable: {[ line.product.metafields.NAMESPACE.KEY }}
So, assuming "custom" is the namespace and "event_info_test" is the key, you could access that metafield with this variable:
{[ line.product.metafields.custom.event_info_test }}
Reference docs:
- https://help.shopify.com/en/manual/orders/notifications/email-variables
- https://shopify.dev/docs/api/liquid/objects/metafield
Oh! I had tried to use that varible before but i havent use the "{% for line in line_items %}" to check before. Now it works great!
Thank you so much! Really appriciate it- 😃
But now I have a follow-up problem. I have several variations of this product and I only want to read this metafield once per product in the email, not once per variant. How can I adjust this?
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025