Hi everyone, does anyone know how to fix the default image being overridden by a variant image.
To give context, when on the product page first image that is displayed is not the default image I selected but instead the first product variant image is displayed. Anyone who knows how to fix this?
Thanks in advance
Shopify automatically changes the main product image when a variant is selected, but you can stop this by adjusting the theme code.
Go to Online Store > Themes > Edit Code, then open product.liquid or main-product.liquid (depending on your theme). Look for code related to variant.image or current_variant.
{%- if current_variant.featured_image -%}
{{ current_variant.featured_image | image_url: width: 800 | image_tag }}
{%- endif -%}
repalce with
{%- if product.selected_or_first_available_variant.featured_image -%}
{{ product.featured_image | image_url: width: 800 | image_tag }}
{%- endif -%}