How to set a default picture in a product when this one have variants in Sense theme?

Topic summary

A Shopify store owner using the Sense theme is experiencing an issue where product detail pages display the first variant’s image instead of the designated default product image, even though the default image is correctly set in the product section.

The Problem:

  • On the main product listing page, the correct default image appears
  • When entering the detailed product page, the first variant’s image displays instead
  • This occurs because a variant (e.g., “blue”) is automatically pre-selected

Troubleshooting Steps Taken:

  • A community helper (namphan) requested and reviewed the product-media-gallery.liquid code
  • Provided modified code focusing on the featured_media variable
  • Initial code change did not resolve the issue

Current Status:

  • The problem remains unresolved after the first code modification
  • The helper has requested collaborator access to the store (petbaggies.store) for deeper investigation
  • The store owner has agreed to provide collaborator access via private message for further troubleshooting
Summarized with AI on October 29. AI used: claude-sonnet-4-5-20250929.

Hello team,

I need your help. I’m using the theme Sense in one of my stores and I can’t set a picture to default in one of my products with variants.

When I enter in the product webpage, the first variant is selected.

Thanks you all!

1 Like

Hey!

Thanks for your answer but that is not the problem.

I have a product, I already set this “picture 1” as default on the product section. When in enter to the product website, “picture 2” is showed (the first variant). This happens because this one is the default variant selected (for example “blue”).

Thanks again.

Hi @CheloChamorro ,

Please send me the code of product-media-gallery.liquid file, I will check and guide it for you

Hi @namphan ,

Here is. Thanks!

Hi @CheloChamorro ,

I tested and the code works fine.

Please send the website link, I will check it for you

1 Like

Hi,

Is petbaggies.store

Thanks for the reply but the problem is not that.

I have a product “a” with some pictures, one of them is a young man modeling it, this product also have some variants. If i enter the main products page, the main picture of this product is showed (good) but when i enter the product detailed website, the first picture showed is the first variant of this one and this happens because by default a variant is already selected.

I just want to enter the datailed product website and see the default picture, not the variant even when this is selected, so you will need to clic on this one again or maybe the variant selection option is not focused on the first one.

Thanks!

Hi @CheloChamorro ,

Please change all code:

{% comment %}							
  Renders a product media gallery. Should be used with 'media-gallery.js'							
  Also see 'product-media-modal'							
							
  Accepts:							
  - product: {Object} Product liquid object							
  - variant_images: {Array} Product images associated with a variant							
  - limit: {Number} (optional) When passed	 limits the number of media items to render						
							
  Usage:							
  {% render 'product-media-gallery' %}							
{% endcomment %}							
							
{%- liquid							
  if section.settings.hide_variants and variant_images.size == product.media.size							
    assign single_media_visible = true							
  endif							
							
if limit == 1							
    assign single_media_visible = true							
  endif							
							
  assign media_count = product.media.size							
if section.settings.hide_variants and media_count > 1 and variant_images.size > 0							
assign media_count = media_count | minus: variant_images.size | plus: 1							
  endif							
							
if media_count == 1 or single_media_visible							
    assign single_media_visible_mobile = true							
  endif							
							
if media_count == 0 or single_media_visible_mobile or section.settings.mobile_thumbnails == 'show' or section.settings.mobile_thumbnails == 'columns' and media_count < 3							
    assign hide_mobile_slider = true							
  endif							
							
  if section.settings.media_size == 'large'							
assign media_width = 0.65							
  elsif section.settings.media_size == 'medium'							
assign media_width = 0.55							
  elsif section.settings.media_size == 'small'							
assign media_width = 0.45							
  endif		

  assign featured_media = product.featured_media
-%}							
							

Not yet :disappointed_face:

Hi @CheloChamorro ,

Can I send you a collaborator invitation? It will help me check things better.

Yeah of course… What do you need?

Hi @CheloChamorro ,

Please send me the collaborator code in private message, I will send you the invitation and check it