Change First Image Selected after Product Page Load

Topic summary

A Shopify store owner wants the second product image to display prominently on page load instead of the first variant image, while keeping the variant selected for pricing.

Initial Solution:
A helper provides code modifications to the product-media-gallery.liquid file, targeting specific lines to change product.selected_or_first_available_variant.featured_media.id to product.featured_media.id. Multiple edits are needed for different layout sections (lines 92 and 233).

New Problem Emerges:
Products without variant images break—no large image displays and the first image disappears from the gallery.

Working Fix:
The original poster creates a conditional solution:

  • Save both original and edited versions of the code
  • Wrap them in an {% if product.variants.first.image %} condition
  • Use edited code when variant images exist, original code otherwise

Ongoing Issues:
Other users report:

  • Missing files in different themes (Sense, Shape)
  • Variant images not loading when clicked after applying the fix
  • URL parameters (?variant=) causing selection issues
  • Price disappearing when only size is selected

One user found success by simply deleting and re-uploading images in the correct order. The discussion remains open with unresolved edge cases across different theme implementations.

Summarized with AI on October 29. AI used: claude-sonnet-4-5-20250929.

I tried this fix, and the first product image now displays properly. However, now none of my variant images will load when clicked. DO you have any suggestions?