Trying to Display Inventory Counts - POP Theme

New Member
5 0 0

I am trying to display inventory counts for my items, but seem to be missing something,

 

I tried this code, but it doesn't work:

</li>
{% 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" %}
There are {{ current_variant.inventory_quantity }} left in stock.
{% else %}
This product is available.
{% endif %}
</div>
{% endfor %}

 

I have items with and without variants and neither display an inventory count. 

0 Likes
Highlighted
Shopify Partner
1891 318 403

Hi,
what's assigned to current_variant, because code is correct

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
0 Likes
New Member
5 0 0

I think I'm missing a current_variant. I just reverted back to the original code. I did something and it added a default field with an unlimited quantity to every field lol

 

I used code for the last theme with no issues though, and Im pretty sure I used the same tutorial :/

0 Likes
Shopify Partner
1891 318 403

Ok, so its working now or need any help.

If helpful then please LIKE and ACCEPT solution so i can help other.

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
0 Likes
New Member
5 0 0

No, its not working, I can't find current.variant

0 Likes
Shopify Partner
1891 318 403

Please check in file where current_variant are assigned before this code. like bellow

{% assign current_variant= something...%}

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
0 Likes