Skip to content

🎁 BFCM is live! Save up to 30% on EComposer and unlock a free Feature Pack. Explore deals

🎁 The4 BFCM: 15% off Athora & Vetro + free homepage setup & 6 months of EComposer Standard free. See the deal

4.93,472 reviews on the Shopify App Store Install free New to Shopify?Open your store

How to create Icon List with metafield and metaobject

Step 1: Create a Metaobject

How to create Icon List with metafield and metaobject — Step 1: Create a Metaobject (Screenshot 1)

It contains 2 fields: Icon and Text

How to create Icon List with metafield and metaobject — Step 1: Create a Metaobject (Screenshot 2)

Step 2: Create Metafield

How to create Icon List with metafield and metaobject — Step 2: Create Metafield (Screenshot 1)

Remember the ID name of the metafield is custom.icon_list_text
You must choose Type: List

How to create Icon List with metafield and metaobject — Step 2: Create Metafield (Screenshot 2)

Step 3: Add entries

How to create Icon List with metafield and metaobject — Step 3: Add entries (Screenshot 1)
How to create Icon List with metafield and metaobject — Step 3: Add entries (Screenshot 2)
How to create Icon List with metafield and metaobject — Step 3: Add entries (Screenshot 3)
How to create Icon List with metafield and metaobject — Step 3: Add entries (Screenshot 4)

Step 4: Assign entries to products

You can select multiple entries per product.

How to create Icon List with metafield and metaobject — Step 4: Assign entries to products (Screenshot 1)

Step 5: Add metafield code

You can add a Metafield element, then change the Metafield source to Custom Liquid and add the code below to the Metafield namespace and key field. custom.icon_list_text is the ID name of the metafield.

{% assign features = product.metafields.custom.icon_list_text.value %}

{% if features != blank %}
  <ul class="product-features">
    {% for feature in features %}
      <li class="product-feature">
        
        {% if feature.icon.value != blank %}
          <div class="product-feature__icon">
            {{
              feature.icon.value
              | image_url: width: 40
              | image_tag:
                loading: 'lazy',
                widths: '20, 30, 40',
                alt: feature.text.value
            }}
          </div>
        {% endif %}

        {% if feature.text.value != blank %}
          <div class="product-feature__text">
            {{ feature.text.value }}
          </div>
        {% endif %}

      </li>
    {% endfor %}
  </ul>
{% endif %}
How to create Icon List with metafield and metaobject — Step 5: Add metafield code (Screenshot 1)

Add CSS code to modify the style of the icon list.

.product-features {
  list-style: none;
  margin: 0;
  padding: 0;
}

.product-feature {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}

.product-feature:last-child {
  margin-bottom: 0;
}

.product-feature__icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-feature__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-feature__text {
  font-size: 18px;
  line-height: 1.5;
}

Add CSS code here:

How to create Icon List with metafield and metaobject — Step 5: Add metafield code (Screenshot 2)

Result

Publish, then check the result on the live page

How to create Icon List with metafield and metaobject — Result (Screenshot 1)

Last updated

Was this page helpful?