0
votes

I have a customised product.liquid template that includes two products in one template, namely: Bikini Top and Bikini Bottom.

The Bikini Bottom is "externally loaded" into the template using its own cart permalink. My question is, when using cart permalinks, how do I check whether the variant is in-stock or sold out and then display a "sold out" notice if needed?

[EDIT] Below is my cart permalink code for reference:

<form action="/cart/add" method="post" class="variantsform">
    <label>Select size</label>
    <select name="id">
        <option value="1189203320">Small</option>
        <option value="1189202416">Medium</option>
        <option value="1189200892">Large</option>
        <option value="1189203928">Extra Large</option>
    </select>
    <input type="hidden" name="return_to" value="back" />
    <input type="submit" value="Add to cart" class="btn variantsadd">
</form>
1

1 Answers

1
votes

at same that you load the variant with liquid, you have to check if is available. Variant manual reference

You also can use the product.first_available_variant