Use Metaobjects in Order Confirmation Email

Topic summary

Users are attempting to display product metafield data in order confirmation emails, specifically a date field and a location name from a metaobject reference.

While simple metafields (like class_date_and_time) work without the .value accessor in email templates, metaobject references cannot be accessed the same way they are in theme files. The code line.product.metafields.custom.location.value.name.value that works in theme templates (like card-product.liquid) fails in email templates.

Current limitation: Shopify’s order confirmation email templates do not support metaobject types, only basic metafields. This applies across all resource types (products, customers, orders, line items). Shopify support has confirmed this limitation and submitted it as a feature request.

Workaround suggestion: Use Shopify Flow with an “Order created” trigger to copy metaobject data into order-level fields (cart attributes, order notes, or order metafields) that can be accessed in email templates.

Status: The discussion remains unresolved pending Shopify platform updates. Users should monitor the Shopify Changelog for future support.

Summarized with AI on November 2. AI used: claude-sonnet-4-5-20250929.

I want to add data from two Product fields to the line item listing in the order confirmation email:

  • Date: This comes from a simple Product metafield called class_date_and_time. The following code works as expected and I can successfully access and display the line_date variable in my email (notice that .value is not appended to the access path):
{% assign line_date = line.product.metafields.custom.class_date_and_time | date: '%b %d, %Y' %}​
  • Location: This comes from a Product metafield also, but the metafield’s value is a Location metaobject value. I need to access Location.name, but it does not seem to work. Here is my code (I have tried every variation of that line I could think of btw, all with no luck):
{% assign line_loc = line.product.metafields.custom.location.value.name.value %}​

I also know that I can access the location metafield as an object. If I adjust the access path to reach just the location metafield (line.product.metafields.custom.location), the variable is assigned the Location metabobject (gid://shopify/Metaobject/xxxxxxxxxx). When I try to access Location.name is where things fall apart.

There are two differences that I can see, that might be important:

  1. Date references a metafield which is a simple date-time value, while Location references a metafield who’s value is a metaobject. Below shows my custom data from the Product object:

  2. [object].value does not seem to work here. Unlike in the theme code editor, .value results in an empty variable in the email editor. If I remove .value from the access path, the variable is properly assigned and I can display my data. I tested this on the Date variable.

Also, this exact code works perfectly in card-product.liquid, where I add data from the location metaobject to the product card.

{% assign loc = card_product.metafields.custom.location.value.name.value %}

So I suppose I have two questions:

  1. Why does .value not work in the email editor, but does in the code editor?
  2. If .value does not work in the email editor, how then can I access the Location name?

And I’m using the Dawn theme if that’s important.

I appreciate any insight on this one.

3 Likes

I’m have the exact same problem. Did you figure this one out?

Cheers

Did anyone have any luck with this one?

Same same, help!

Unfortunately, while Shopify supports including metafields within the Order Confirmation email template, that doesn’t include support for metaobject types at this time. I asked Shopify support about this, who confirmed the situation as below. I was asking about Customer metafields, but I expect this goes for all resource types including products, orders, line items, etc.

You are correct in noting that regular metafields can be accessed using the syntax you’ve mentioned ({{ customer.metafields.custom.message }}). This is indeed possible and should be documented more clearly.

As for accessing Metaobjects from a customer within the email templates, this functionality is currently not supported. However, given your successful use of regular metafields and the potential for extending this functionality, I understand the importance of this feature for you and other merchants.

They say that they’ve submitted it as a feature request, so perhaps they’ll add support for this in future. It’s worth keeping track of the Shopify Changelog, as they mention platform updates and changes there.

You might want to explore using Flow to copy data from metaobjects, so long as there’s a trigger event that’ll do that when you need it. In your case, perhaps you can use the Order created trigger to copy selected product metafields to the order as cart attributes, order notes, order metafields or a similar approach. It does depend on what you are trying to achieve and where / how you are attempting to show this data, though!

1 Like

Appreciate ! Thanks :heart: