Liquid, JavaScript, themes, sales channels
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!
Bump - anyone have any ideas? Really confused about this one.
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024