Hi Experts,
We have an issue in Shopify about products with variants. If any product includes variants, Shopify automatically shows its product variant picture first in the product page. For example this product: https://hugobrunto.se/products/modulsoffa-chloe
The first image in the link is now the variant picture. But it should be the grey sofa because it is first in row in our pictures.
We have located the code:
{%- if product.selected_or_first_available_variant.featured_media != null -%}
and replaced it with:
{%- if section.settings.product != blank -%}
{%- assign featured_media = product.images.first -%}
{%- endif -%}
But it can’t be fixed. Have also tried several different codes but it doesn’t work at all.
It there any other way to show the first image first on the product page?
Best regards,
Hugo Brunto
@Hugobrunto just use product.images.first as the condition, or just use it directly without conditions.
We have located the code:
WHERE, which file, where have you located the code that type of behavior is often used through a theme.
So even if you changed it it doesn’t matter if it’s not changed in the right place.
The code you’ve provided makes no sense on a product template the product always exists.
{%- if section.settings.product != blank -%}
{%- assign featured_media = product.images.first -%}
{%- endif -%}
Unless you mean your assigning a product in a setting for section somewhere, and some unprovided code uses the featured_media variable further in the section.
in which case you need to drastically improve the quality of the problem statement.
Hi Paul ,
Thanks for your answer. Then I understand that i’m not in the right place. I think I found that code above in sections → main-product.liquid. I have too many possible files in “Edit Code” and I’m tired of guessing 
Do you know in which of these files below to edit any code? If yes, what to change in that file? I’d love your help and it would be an honor.
Sections → Main-Product.Liquid
Snippets → Card-Product.Liquid
Snippets → Product-Media-Gallery.liquid
Snippets → Product-Variant-Options.liquid
Thanks for helping just a little 
Depending on theme, such as dawn, main-product.liquid , or Product-Media-Gallery.liquid would be the right section.
You can confirm this by inspecting the themes product JSON template and seeing if main-product.liquid is statically included.
More than likely the code is also a problem.
Good Luck.
1 Like
Hi again,
thanks for helping. I use a code named ”IRIS” by Mana Themes. I will try in that files as you suggested. I’m not sure what to look for or what to replace though 
/Hugo