Open product page on available variant, instead of unavailable variant

Topic summary

Issue: On the Horizon theme, product pages default to the first variant in admin order, even when that size is out of stock. Example: selecting the Cobalt color opens on the smallest (OOS) size despite larger sizes being available. The merchant wants automatic selection of the next available size (ascending) when the default is OOS.

Guidance provided:

  • Check theme settings for options to: disable auto variant selection, hide out-of-stock variants, or similar stock-aware behaviors.
  • If no setting exists, implementing stock-aware auto-selection requires advanced theme customization (editing theme files) to dynamically hide/select only available variants.
  • Reference documentation: Shopify dev guide on variant selection and product merchandising (link provided).
  • Hiring a developer is suggested if custom behavior is needed.

Status: No confirmed built-in toggle or code provided. Outcome pending the merchant reviewing theme settings or pursuing custom development. Open question: whether Horizon includes a stock-aware auto-selection feature without custom code.

Summarized with AI on December 11. AI used: gpt-5.

Hi,

Using Horizon theme, straight outta the box. Currently the default behaviour is to open a product (t-shirts, for example) to the order of the variants in the product backend, however some sizes are out of stock, and the theme is not defaulting to open the product page on a product size that is in stock.

How can I force it to do so? Links:
This product here: Kids T-Shirt – Rewiring Australia

  • Opens on the lowest possible size - great
  • Click to Cobalt variant, and it opens on the lowest possible size, which is out of stock, but there are larger sizes in stock.

What I want is it to run with logic that if it opens on a product that is out of stock, it tries the next highest, and upwards, till there is a size in stock that it can display.

Anyone know of a solution for this?

Thanks.

Hi @BroDudeEnergy :waving_hand: check the theme for a setting to disable variant selection, hide out of stock variants, or enable related behaviors if a theme has such features etc etc ad nausem.

Otherwise dynamically hiding unavailable variants or selecting only “available” variants is an advanced theme customization requiring file modifications that vary by theme, and teaching web development is beyond the scope of the forums.

Learning about variant selection in themes is documented here:
https://shopify.dev/themes/product-merchandising/variants

Merchants that need custom theme behaviors can reach out to me for customization services.
:speaking_head: :postbox: CLICK profile-pic on forums for options to connect.
ALWAYS include context in new communications, e.g. reference urls, posts urls, etc