Crave override automatic variant photo display

I’m using the Crave theme and am trying to change the first photo displayed when customers visit this product page: Farmer's Market Alphabet (framed) – Produce Aisle

I want to select my own main photo (screenshot attached) instead of displaying the first variant photo. I’m confused about what code to delete versus edit. I’d love some clear guidance.

The best possible way which I believe you already know but just to confirm is adding that main image that you need to show as the product page loads as the first image in the media library inside your product.

Best

Problem: Crave loads the first variant photo as the main image, not the one you chose.


Results after applying the fix:

Fix:

Put your main photo first

  • Open the product, drag the photo you want as the main image to the first spot under Media, then Save.

Make the theme respect that order

  • Online Store > Themes. On Crave, click the ... menu > Edit code. (Duplicate the theme first if you want a safe backup.)
  • Open snippets/product-media-gallery.liquid.
  • Press Ctrl+H to open Find and Replace, and turn on Replace all.
  • Find: product.selected_or_first_available_variant.featured_media
  • Replace with: product.featured_media
  • There are 7 matches. Replace all, then Save.

Regards,
Ploqo

Hi @mk331

Yes I want the second thumbnail to be active/selected automatically when the product page loads.

  • First image remains available in the gallery.
  • Second image should be the initially displayed/active image.
  • No need to delete the variant-image functionality.
  • Variant switching should continue to work normally.

If you share the relevant Crave theme code, I can show you the exact change needed.

Best regards,
Devcoder :laptop:

@mk331 If you want to keep the variant images but stop Crave from automatically switching the main image, I’d look at the variant media logic rather than trying to hide the images with CSS.

Crave is using the selected variant to decide which media gets shown, so the cleaner fix is to change that JavaScript behaviour.

I’d also test it with products that have multiple variants and multiple images per variant. It’s easy to fix one product and accidentally break the gallery for the others.

It will help you:

Hi @mk331 :waving_hand:

Just want to add another solution you could consider in case you want more freedom and control over which image is displayed when customers select an option without editing your Crave theme code by using Aris Product OptionsChange product image upon option selection feature.

Instead of being limited by Shopify’s native variant-image setup, you can assign the specific image you want to appear for each option value. This gives you more flexibility to control the product images customers see as they click through the different options.

You can see how it works in this live demo that comes with a brief instruction: Change product image upon option selection – Aris Product Options, Variants demo

This could be a good workaround if you’d rather avoid modifying the Crave theme code directly and I believe could be useful when Shopify’s native variant image behavior is limiting which image appears first.

Hope this helps! :fire: