Re: Dawn 2.0 - Adding quantity available to product page

Dawn 2.0 - Adding quantity available to product page

VividFrameworks
Visitor
2 0 0

I feel like this really shouldn't be that difficult. Would anybody have the code that I need to copy and paste into the product page template?

Replies 25 (25)

PaulNewton
Shopify Partner
7192 635 1494

Merchants that need to buy this customization can contact me at [email protected] 

Different approaches :

  • Shopify has a tutorial for a few themes, they will install it as well for some themes:
  • There are also various solutions for implementing 'available inventory' throughout the forums found with search.
    • Though the complication will be updating the available amount when the variant changes.
  • A rough non-updating solution is to make a metafield definition then just add a text block and wire it to that metafield definition as a dynamic source, note this is a number you have to manually update.

 

 

Contact [email protected] for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


BeholdGames
Tourist
5 0 8

I've tried using the same code I used in the old shoplify themes but its not working and only showing me the "this product is available"

So I am also keen for the solution.

 

{% comment %} Inventory tracking on product page {% endcomment %}
<div id="variant-inventory" class="{% unless current_variant.available %} hide {% endunless %}">
{% if current_variant.inventory_management == "shopify" and current_variant.inventory_policy != "continue" %}
We have {{ current_variant.inventory_quantity }} in stock.
{% else %}
This product is available.
{% endif %}
</div>

BeholdGames
Tourist
5 0 8

Ok ii found this code and it seems to work for me.

 

<DIV>{% if product.variants.first.inventory_management == "shopify" and product.variants.first.inventory_quantity > 0 %}
We currently have {{ product.variants.first.inventory_quantity }} in stock.
{% endif %}</DIV>

jmp
Excursionist
23 2 51

Thank you! Exactly what I was looking for.

mstav2u
Excursionist
21 0 1

This goes in the product template then?  Does it matter where exactly?  Thanks.

BeholdGames
Tourist
5 0 8

Screen Shot 2021-10-26 at 3.36.56 pm.png


On the products page, in the GUI editor I added a code snippet and added it in there and then moved it around until I like where it displayed. 

Screen Shot 2021-10-26 at 3.37.43 pm.png

mstav2u
Excursionist
21 0 1

Thank you for the information.  I guess what I'm looking for is actually where the quantity selector stops at the amount left in stock.  Right now it goes on for infinity and then if you click add to cart, it is then that it tells you, you can't add that many.  It may not seem like a big deal, but customers may not notice the amount that's left in stock, even though it's right there.  Maybe since the quantity left is showing, that's all a seller can do with the Shopify themes?  I would like the quantity selector to stop where the stock quantity is.  In other words, 10 left in stock, so when a customer goes to order they click up to 10 and the quantity selector stops at 10 and won't go higher.  I have a large variety of variants, so just wondering about this. 

Diashop
Excursionist
15 0 7

I used the code posted above in a snippet and it works for the first variant only. If a different variant is selected the text does not change. 

Any idea on how this can be done to have the numbers updating with different variants being selected?

Thanks in advance for any advice!

critters21
Visitor
1 0 0

Did you find out how this is done? I need to know this also.

mstav2u
Excursionist
21 0 1

I haven't received any answer to what I want with the quantity.  I did purchase an app which shows the available amount in stock, but the counter goes on forever and I don't feel it should go past the amount in stock and this is what I'm looking for.  If someone has a code, just give me the steps on how to implement it to make this work like I feel it should.  Maybe it isn't possible, but still hoping there's someone that can let me know.  Thanks and hopefully answers will be coming. 

jm-design
Excursionist
25 1 6

I would also like to know! As I am having the same issue with variants.

SpotterJ
Shopify Partner
67 1 17

Any luck?

Learning something new every day
BecEnglishCeram
Tourist
3 0 2

I ended up having to get theme support to resolve the issue with variant products. They added the "Inventory" block which I couldn't access. I've asked why it wasn't available for me to add, when I get a reply I'll update you. I'm also going to play around with a better message than"Stock:"

This is how it displays on my live website https://becenglishceramics.com/products/green-tea-side-plate?variant=41249832763584:

BecEnglishCeram_0-1639274106829.png

 

BecEnglishCeram_1-1639274138124.png

 

SpotterJ
Shopify Partner
67 1 17

Thank you.

The excellent @PaulNewton gave some background information on this issue on this topic: https://community.shopify.com/c/technical-q-a/klaviyo-and-quot-display-on-policy-continue-true-quot-...

 

I wasn't aware about the theme help, that's excellent. 

 

Oh, and nice products, btw!

Learning something new every day
BecEnglishCeram
Tourist
3 0 2

Thanks Paul!

mstav2u
Excursionist
21 0 1

It looks like the quantity counter goes on forever though and that's what I want to avoid.  For example I know it says stock 2, but if customers click on 6 to add to cart it is then that they get a message you can't add more to your cart.  I don't know but I am trying to find a way to show if there are 6 in stock, then the counter stops at 6.  This make sense?  

sellingstuff
Shopify Partner
18 0 0

I would also like some help on this. I think it gets added in global.js but I can't find where to update it from

SHASHA5
Visitor
2 0 0

Hi,

this keeps saying only 1 in stock but I have more?

 

do you possibly have a solution please??

OliviaMichaelCo
Pathfinder
120 9 27

This worked perfectly for me, except when there’s zero stock it shows “Just 0 in stock”. Is there a simple change to this that I can make to only work when I have more than 1 in stock but fewer than 6 in stock? I only want to add this when I get below 6 of a product. 

 

Thanks

 

<DIV>{% if product.variants.first.inventory_management == "shopify" and product.variants.first.inventory_quantity > 0 %}
We currently have {{ product.variants.first.inventory_quantity }} in stock.
{% endif %}</DIV>

Stage
New Member
5 0 0

I could use that too 🙂

OliviaMichaelCo
Pathfinder
120 9 27

Hey @Stage I just use the following custom liquid field on my product page.

 

<DIV>{% if product.variants.first.inventory_management == "shopify" and product.variants.first.inventory_quantity < 6 and product.variants.first.inventory_quantity > 0 %}
Only {{ product.variants.first.inventory_quantity }} left in stock!
{% endif %}</DIV>

 This looks to see if there are fewer than 6 in stock but more than 0 products and then outputs, "Only 3 left in stock!"

 

If the product is out of stock it's hidden and if there are 6 or more in stock it's hidden. Just change the numbers as required. 

mstav2u
Excursionist
21 0 1

And this code is put where? Thanks.

MyCartridges
Tourist
4 0 0

It works great, thank you. The only problem is that it doesn't work with a product with multiple variants. It just shows the stock quantity of the first variant...

BecEnglishCeram
Tourist
3 0 2

Hi 👋 

I ended up getting the Shopify tea to resolve this for me. They were really helpful.

I couldn’t find a way to resolve the issue with variants without them.

Bec

MyCartridges
Tourist
4 0 0
Sorry I'm a complete noob, how do i go about getting the Shopify team to
resolve this for me? Thank you Bec