jungalist
jungalist

Reputation: 57

Shopify Liquid metafields: accessing description

I can access my metafield information like so:

{% assign mf =  product.metafields.Specs %}

{% unless mf == empty %}
   {% for mf in product.metafields.Specs %}
       {{ mf.first }}: {{ mf.last }} <br />
   {% endfor %}
{% endunless %}

But that doesn't get me anything but the key:value. How do I get the other information? I have tried:

{% assign mf =  product.metafields.Specs %}

{% unless mf == empty %}
   {% for mf in product.metafields.Specs %}
       {{ mf.key }}: {{ mf.value }} : {{ mf.description }} <br />
   {% endfor %}
{% endunless %}

But that just gives me a list of ":" with none of the text. What am I doing wrong there?

Upvotes: 2

Views: 1640

Answers (1)

Caroline Schnapp
Caroline Schnapp

Reputation: 808

How about using this:

  {% assign mf = product.metafields.Specs %}
  {% unless mf == empty %}
    {% for f in product.metafields.Specs %}
      {{ f.first }}: {{ f.last }} : {{ mf[f.first].description }} <br />
    {% endfor %}
  {% endunless %}

Upvotes: 0

Related Questions