FROM CACHE - en_header

Display inventory quantity on Dawn theme

tim_gordon
New Member
2 0 2

Can anyone point me in the right direction for how to display inventory quantities on the product page in the Dawn theme i.e. OS 2.0. I have done this before in an old Shopify store and there are plenty of liquid examples documented but I can't find an example for 2.0 themes. In my use case I only have one inventory location but I do need to it work for variants.

- Have I missed something, is this a standard feature in 2.0 that I can turn on somewhere?

- Can this be achieved neatly by using a Custom Liquid Block?

- Or does anyone have an example of how to achieve this?

Thanks in advance.

Replies 2 (2)
tim_gordon
New Member
2 0 2

Anyone able to point me in the right direction on this? There are lots of examples online in how to do this in the old API but not for Dawn. If anyone knows if it is still possible that would help and I will keep digging.

beadtin
New Member
2 0 0

I added a Custom Liquid block to the "production information" section and then inserted the following code: <h3>We have {{ product.first_available_variant.inventory_quantity }} pen(s) available</h3>.

The key element here is {{ product.first_available_variant.inventory_quantity }}, everything else is just to make the text look nice. I haven't tried the if statement to make the singular or plural statement correct, just used the "(s)" to begin with