Hey everyone,
I’m trying to display a list of available variants on my product page via Liquid Code. I’ve already found a code to do this for the current product. The catch is that I’m trying to do this for a product that I’ve linked via variant.metafields.
Let me explain:
I’ve linked product X to product Z via a variant.metafield.
On the productpage of product Z, I would like to show a list of available variants for product X.
This is the code that I’ve found to do this for the current product. Does anyone know what needs to be changed in order to do this for the linked-product?
{% if product.variants.size > 0 and product.available %} {% unless product.has_only_default_variant %}
This tile is available in these sizes:
{% for variant in product.variants %} {% if variant.available %}
{{ variant.title | append: ‘
’}}
{% endif %}
{% endfor %}
{% endunless %}
{% endif %}
Thanks for your help in advance!