How to display metafields within metafields

6 0 1

Hello all,

We are migrating specifications for hundreds of products, and am trying to display the following metafield 


  within HTML in a multitext field (I've tried single-text and rich-text too):






<table class="product-spec-table">
           <td>Maximum Brightness</td>






And in my code, I have 






{{ product.metafields.productDetails.specifications.value}}






However, I can't get the metafield to display its value; it just displays product.metafields.productDetails.brightness. Is there a way to display it within a multitext/rich text/single text metafield?


Thanks in advance!

Replies 2 (2)

Shopify Partner
197 22 29

I think you might need to save "specifications" as a JSON type metafield:


Then you can access it as follows:

{% assign specifications = product.metafields.productDetails.specifications %}
{% assign parsed_specifications = specifications | json_parse %}


And use the following to access "value" in specifications

{{ parsed_specifications.value }}


Please check; I haven't tested it 🙂

Founder @ JsRates: Custom Shipping Rates
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more about JsRates visit the JsRates home page or JsRates documentation
- Find JsRates on Shopify app store

Shopify Expert
3274 236 1183

This depends on whether  your metafields are legacy or new ones.

Legacy metafields do not have value  property. 


You should be able to migrate legacy metafields to modern by adding metafield definitions in Settings -> Custom data

If my post is helpful, consider liking it -- it will help others with similar problem to find a solution.