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

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

CrazyGen_IN
Tourist
12 0 4

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

different collections have different metafield:"material" value...

Replies 3 (3)

anupam1607
Shopify Partner
44 7 8

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 %}
      <p>Material: {{ collection.metafields.custom.material }}</p>
    {% break %}
    {% endif %}
  {% endfor %}
{% endif %}
Buy me a coffee.
- Was your question answered? Mark it as an Accepted Solution. ❤️
- Don't forget to give me Thumbs Up.
- Store, Product and Collection Modifications | Apps and Sales Channel | Animation
- Lets connect anupammistry1607@gmail.com 

Abehub
Shopify Partner
4 0 2

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 ?

Abehub
Abehub
Shopify Partner
4 0 2
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!
 
 
 
 
Abehub