Shopify themes, liquid, logos, and UX
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 -%}
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
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025