Is there a way to pin different metafileds for different collections.
So for example i have 20 pinned metafileds for a certain products but i need use different metafields on different product is this possible i cant find way of using the unpinned ones?
In Shopify, metafields are typically associated with specific product or variant objects and are not directly linked to collections. However, you can still achieve the desired functionality by leveraging metafields and product tags.
Here’s a possible approach:
-
Assign product tags: Assign unique tags to the products that require different sets of metafields. For example, you can create tags like “Metafield Set 1,” “Metafield Set 2,” etc.
-
Define metafields for each set: Create metafields for each set of products that need different metafields. You can use an app like Metafields Editor or create the metafields programmatically using the Shopify API.
-
Access metafields based on product tags: In your theme code or any customizations you make, you can check the product tags and retrieve the associated metafields. This can be done using Shopify Liquid code or by making API calls.
{% if product.tags contains 'Set A' %}
{% assign metafieldSet = 'Metafield Set 1' %}
{% elsif product.tags contains 'Set B' %}
{% assign metafieldSet = 'Metafield Set 2' %}
{% endif %}
{% for metafield in product.metafields[metafieldSet] %}
{{ metafield | escape }}
{% endfor %}
Hi “NomtechSolution”
Thank you for the quick response
So How do i create metafield sets? also where do i paste this code in the theme.liquid tab?
Kind Regards