Why does my inventory report false stock status for double-digit quantities?

Hello,

I’m having a recurring problem with displaying an “in stock” or “out of stock” message for one of our stores.

Here is the code:

{%- if product.selected_or_first_available_variant.available == false -%}

In stock - Ships within 1-2 business days
3-4 week lead time

{%- else -%}

In stock - Ships within 1-2 business days
3-4 week lead time

{%- endif -%}

The variable product.selected_or_first_available_variant.available seems to be showing as FALSE (ie. there is no product variant available for sale) when the inventory for the variant is above 9 (or double digits). So that when there is inventory for a specific variant, it shows the “3-4 week lead time” message (out of stock) instead of showing in stock.

As soon as the inventory is decreased to a quantity of 9 or lower, the in stock message shows properly.

Does anyone know why this is happening?

Thanks in advance!

Bump - anyone have any ideas? Really confused about this one.