DEFAULT IMAGE

DEFAULT IMAGE

BaT2025
Visitor
1 0 0

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

Reply 1 (1)

EcomGraduates
Shopify Partner
826 70 120

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 -%}

 


 If this fixed your issue, likes and accepting as a solution are highly appreciated
|  Build an online presence with our custom-built Shopify Theme: EcomifyTheme
|  Check out our reviews: Trustpilot Reviews
|  We are Shopify Partners: EcomGraduates Shopify Partner