Liquid, JavaScript, themes, sales channels
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.
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.
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
User | RANK |
---|---|
33 | |
25 | |
17 | |
9 | |
9 |
Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023Summary of EventsBeginning in January of 2023, some merchants reported seeing a large amo...
By Trevor May 15, 2023With 2-Factor Authentication being required to use Shopify Payments, we’re here to help yo...
By Imogen Apr 26, 2023