Inventory reporting bug

srdjank
Shopify Partner
6 0 0

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 -%}
<div id="instock" style="float: left; font-weight: bold;" class="hide">
In stock - Ships within 1-2 business days
</div>

<div id="outofstock" style="float: left; font-weight: bold;" class="show">
3-4 week lead time
</div>

{%- else -%}
<div id="instock" style="float: left; font-weight: bold;" class="show">
In stock - Ships within 1-2 business days
</div>

<div id="outofstock" style="float: left; font-weight: bold;" class="hide">
3-4 week lead time
</div>

{%- 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!

Reply 1 (1)
srdjank
Shopify Partner
6 0 0

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