Metafields not displaying in product.liquid

Metafields not displaying in product.liquid

3 0 0

We had a third party import values as metafields into shopify. I'm trying to use the metafields on our product.liquid page but they're not displaying. Here's an example of the code:

        {% if %}  
        <div class="description rte" itemprop="description">  
         <b>Material Color:</b> {{ }}
        {% endif %}


The name space is: global
Key is: attribute.material-color

Is it because of the period in the key? All the values that were transfered used that format; attribute.NAME.

Replies 3 (3)

Shopify Partner
31 0 5


I use a simple call which just uses the namespace:

{% for field in product.metafields.mColour %}<b>Colour:</b> {{ field | last }}<br />{% endfor %}

- Mike

Shopify Expert
11196 226 2287

If you need to grab a specific metafield with a period in the name you can do so like this:

{{['attribute.material-color'] }}


★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. ★

3 0 0

That worked. Thank you so much! I was having a lot of trouble with this.