If I have for example a product in 10 different colors. each color has it’s own name, SKU and description. I already made each color as a single product as I need all of them to be available in collections, however, i want to have them all linked with each other, so for example, if customers opens red product, they will see all the other colors in variants (brown, yellow etc.) but what is important is that the variants’ SKU is connected to a single product due to inventory tracking . So basically, I need the products LINKED with each other. and seen as variants. This is the example of what i want to achieve: https://concept-theme-tech.myshopify.com/products/air-beats-gold-tone
How can I achieve that?
I tried adding metafield values (type: product; list of products), but I didn’t find a way to show that on my product page. I use Enterprise theme.
Any help would be much appreciated, preferably if I can do it myself or with a free app!
@enterprise123 the Theme “Concept” (your example) as well as “Be Yours” have a build in feature for this.
If you want to do it by yourself, you’ll have to use the product reference (list) metafield, link the products and display them via custom liquid code.
This is an example of how the code should look like to display the variants as a list including a link.
{% assign siblings = product.metafield.[namespace].[key].value %}
{% for sibling in siblings %}
- {{ sibling.title }}
{% endfor %}
Please replace namespace and key with your definitions
When you are assigned the variants of a product, you have to repeat this process for each variant.
If you want to display the color instead of the product title, you’ll have to modify the code.
Your code worked, except there was a small mistake at the beginning (it should be product.metafields.[name]…, instead of product.metafield.[name]…) but I was able to figure that out. Thanks a lot!!!
Also, are you able to help me achieve the displaying first product image of the variant instead of the list?
This post was helpful. I was able to take it a step further and display the swatches/swatch images associated with the shopify category metafield for color. As suggested, I used a metaobject to hold my various sibling groups and a metafield with the metaobject reference on the product. In case anyone finds it helpful: