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 |
---|---|
21 | |
20 | |
8 | |
8 | |
7 |
Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...
By Jacqui Mar 10, 2023Upskill and stand out with the new Shopify Foundations Certification program
By SarahF_Shopify Mar 6, 2023One of the key components to running a successful online business is having clear and co...
By Ollie Mar 6, 2023