how to hide single variant label/button when only has one variant for a product? (Dawn Theme)

Topic summary

Issue: A merchant using Dawn theme (v13.0.1) wants to hide variant labels/buttons for products with only one option (e.g., showing size variants but hiding single-option color/fabric selectors).

Constraint: The merchant needs to keep these single variants in the backend for Google Merchant Center feed requirements, but hide them from the front-end display.

Solution Provided:

  1. Edit product-variant-picker.liquid file in theme code
  2. Add {% assign variant_count = option.values | size %} next to the line {%- for option in product.options_with_values -%}
  3. Add conditional code {% if variant_count <= 1 %}hide_single_variant{% endif %} next to both “product-form__input–pill” and “product-form__input–dropdown” classes
  4. Add CSS rule .hide_single_variant { display: none !important; } to base.css file

Initial Problem: First approach caused “item unavailable” errors because hiding variants broke the add-to-cart flow (which requires all variant options to be selected).

Resolution: The revised solution successfully hides single-option variants while maintaining functionality. Confirmed working by original poster.

Note: One user with Turbo theme v3.0.1 requested similar guidance but lacks the product-variant-picker.liquid file (theme-specific difference).

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

sorry, i forget to keep this code {% assign variant_count = option.values | size %}, i just updated code again and now its working properly.

Thank you so Much :blush: