Change default variant for product

Topic summary

A user wants to set Medium as the default product variant for apparel items instead of XS, while keeping the size order (XS, S, M, L, XL) unchanged in the display.

Current Issue:

  • When viewing products (e.g., Lilac variant), if XS is unavailable, the system defaults to XS anyway rather than selecting an available size like Medium
  • A screenshot was shared showing this behavior

Proposed Solutions:

Simple approach: Rearrange variant order in Shopify’s product settings (though this changes display order)

Advanced approach: Modify theme code to set a different initial product variant

  • For some themes, this involves editing instances of product.selected_or_first_available_variant to product.first_available_variant
  • This ensures the first available variant is selected, not just the first listed variant
  • Implementation can be done by setting productOptions values either by index or through other methods

Important distinction: Selecting any variant versus selecting specifically available variants requires different logic. The responder noted this might be an XY problem and offered paid customization services if needed.

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

Hi all!

I’d like to change the product variants for my apparel to default to the Medium size rather than XS, ideally without re-arranging the variants (would still like it to appear as XS,S,M,L,XL - but land on Medium as the default for products).

I’m using the latest Dawn template.

Thanks!

Site isn’t live yet, may I share a screenshot?
So if I’m on the Lilac variant, XS is not available but automatically the default we land on. And I’d rather it land on Medium.

Hi @toteko :waving_hand: Make sure this isn’t an xyproblem with unclear goal https://xyproblem.info/

there is a difference between selecting any different variant, and selecting AVAILABLE variants.

Either just rearrange the variants

https://help.shopify.com/en/manual/products/variants/edit-variants

Or otherwise at the online-sales theme an advanced theme customization could be done to set a different product as the initial product either by index or testing the values of the productOptions.

:bomb: To be clear this is NOT the same logic making it so an available variant is what’s selected ; for that in some themes all that’s needed is to edit the instances of product.selected_or_first_available_variant to just be product.first_available_variant.

If you need this customization then contact me for services
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.