Hello
I am not techy in the slightest so please be patient with me.
I want the customer to be able to click on a swatch image for each variant so I have added a variant image for each option. However, the circles are just greyed out. Could you please help? I am using the Showcase theme.
Thanks
Jemma x
- In the code editor, locate the
product-form.liquid file under “Sections” or “Snippets”.
- Look for the code block that starts with
{% if option == 'option1' %} (or similar) and contains the logic for displaying swatch images.
- Replace that code block with the following updated code:
{% if option == 'option1' %}
{% for value in option.values %}
{% if product.options.size > 1 %}
{% assign option_index = option_position | plus: 1 %}
{% assign option_key = 'option' | append: option_index %}
{% else %}
{% assign option_key = 'option' %}
{% endif %}
{% assign selected_value = variant.options[forloop.index0] %}
{% assign variant_image = product.selected_or_first_available_variant.image %}
{% for variant in product.variants %}
{% if variant[option_key] == value %}
{% assign variant_image = variant.image %}
{% break %}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
​
Hi there,
Thank you for this. I am also having the same issue.
I didn’t have a product-form.liquid and tried to create it under sections/snippets and it still doesn’t show properly.
Any advice?