We are trying to show a message under each line item in the cart for the customer.
If the customer’s cart quantity for a line item is more than the item inventory available stock, the message should appear. Does anyone know the correct liquid code? “cart.item_count” does the job, but for the total including every item.
Hi @Patchcollection ,
You can use the following code:
{% if item.variant.inventory_quantity > -1 %}
{% if item.quantity > item.variant.inventory_quantity %}
{% endif %}
{% endif %}
Ex:
Hope it helps!
Great. Works as intended. Thank you for your help.
Aleon
October 12, 2022, 2:05am
4
Hello how can I do it for the product and the collection
Aleon
October 12, 2022, 3:02am
5
Hello how can I do it for the product and the collection?
Hi @Aleon ,
You can create a question on the community and send me the link. I will check it.
Because this will help build a better community.
Thank you.
Aleon
October 17, 2022, 7:10pm
7
Toland
October 20, 2022, 11:39am
8
Hi, i want to show stock quantity under quantity, can you help me, thank you very much, have a nice day
Store: https://nigahimastyle.com/
Toland
October 20, 2022, 11:40am
9
hi, i want to show stock quantity under quantity, can you help me, thank you very much, have a nice day
Hi @Toland ,
You can create a question on the community and send me the link. I will check it.
Because this will help build a better community.
Thank you.
Toland
October 20, 2022, 1:37pm
11
Aleon
October 21, 2022, 2:36pm
12
This is how it shows
Unidades disponibles {{ product.selected_or_first_available_variant.inventory_quantity }}
and if it works for you, validate the input before adding to the cart
and it would be something like this