there is a way to display a collection metafield in the porduct page?
Each product have a product type that matches the collection, so in the product page of this product I want to display the metafield of that product.
{{ collection.metafields.custom.metafield1 }} doesn’t work because of course I’m not in the collection page, so I need to link collection.metafields.custom.metafield1 and product.type, but I don’t know how.
Hope I was clear, thank you.
Each product have a product type that matches the collection, so in the product page of this product I want to display the metafield of that product.
3
Answers
yes I understand your point, and I figure out your code and I tried to use it:
and I don't understand why it does not work.
I attach a sceenshot of the metafield in order to be more cleare.
metafield structure
Hard to understand your question, but it would probably go like this. In Liquid, every product has a type. So you would use that on the collections object to get just the collection you want, and from that, the special metafield assigned.
That assigns some collection, assuming it exists, based on the current product type, to your variable. Now you would ask for your special metafield that may or may not exist in that collection’s metafields.
And with that, you could get the value and splash it out there as you please.
I solved with the following code
As you suggest it was fun to solve the problem 😀