How to show collection metafield value to every product that comes under it?

How to show collection metafield value to every product on product page that comes under that category…

different collections have different metafield:“material” value…

Hey @CrazyGen_IN

In the product template, try to add below code for collection metafield.

{% assign product_collections = product.collections %}
{% if product_collections.size > 0 %}
  {% for collection in product_collections %}
    {% if collection.metafields.custom.material != blank %}
      

Material: {{ collection.metafields.custom.material }}

    {% break %}
    {% endif %}
  {% endfor %}
{% endif %}

To display a collection metafield like “material” on product pages without coding, install a metafield app such as Metafields Guru or Matrixify from the Shopify App Store, ensure each collection has the “material” metafield filled out, follow the app’s instructions to configure the display settings, and then preview your product pages to confirm the information appears correctly.
what do you think about this ?

If this solution works for you, please show your support by giving it a Like and mark it as an Accepted Solution once your issue is resolved!