Unavailable size get available after selecting any size

Topic summary

A Shopify store owner reports a product variant selection bug on their polo t-shirt collection page. When users click the plus (+) button to choose a size, some sizes initially appear disabled. However, once any available size is selected, the previously disabled sizes become available and can be added to cart—allowing customers to purchase unavailable inventory.

Technical Details:

  • Issue occurs specifically with size variant selection
  • Problem affects inventory control and could lead to overselling
  • User provided code snippet showing their variant selection form implementation

Current Status:

  • The poster is seeking help to resolve this variant availability logic error
  • No solutions have been provided yet
  • The issue appears to be in the JavaScript/Liquid code handling variant availability states
Summarized with AI on November 19. AI used: claude-sonnet-4-5-20250929.

https://chkokko.com/collections/men-polo

(Men’s Regular Fit Polo T-Shirt With Pocket ) In this product when you choose size by clicking +(plus) button few sizes are disable but when you select one from available size then other disable size variant available and any one can do add to cart.

Please help me out from this.

I have mention the code below.

{% assign id_form = id | append: '-' | append: product.id %} {% for option in product.options_with_values %} {% assign option_name = option.name | downcase %} {% assign option_color_swatch = settings.option_color_swatch | downcase %} {% if settings.use_color_swatch %} {% if option_color_swatch contains option_name %}
{{ option.name }}: {{ option.selected_value }} {% assign option_index0 = forloop.index0 %} {% assign option_index = forloop.index %} {% assign values = '' %} {% for variant in product.variants %} {% assign value = variant.options[option_index0] %} {% unless values contains value %} {% assign values = values | join: ';' %} {% assign values = values | append: ';' | append: value %} {% assign values = values | split: ';' %} {% assign value_2 = value | remove: " " | downcase %}
{% if variant.image != blank %}{% endif %}
{% endunless %} {% endfor %}
{% else %}
{{ option.name }}: {{ option.selected_value }} {% assign option_index0 = forloop.index0 %} {% assign option_index = forloop.index %} {% assign values = '' %}

{% for variant in product.variants %}
{% assign value = variant.options[option_index0] %}
{% unless values contains value %}
{% assign values = values | join: ‘;’ %}
{% assign values = values | append: ‘;’ | append: value %}
{% assign values = values | split: ‘;’ %}
{% assign value_2 = value | remove: " " | downcase %}

{{ value }}
{% endunless %} {% endfor %}
{% endif %} {% else %}
{{ option.name }}: {{ option.selected_value }}
{% endif %} {% endfor %}
{% comment %} {{ 'products.general.submit' | t }} {% endcomment %} ADD TO CART {{ 'products.general.cancel' | t }}