Adding Quantity Sold to the product page?

Mariana7
Visitor
2 0 0

How do I show the quantity of items sold on the product page? So that the quantity in stock is equal to that of sold + 1..

I use the code like this, but every time there is a sale, the value goes down xD

{% assign product_qty = 0 %}
{% for variant in product.variants %}
{% if variant.inventory_quantity > 0 %}
{% assign product_qty = product_qty | plus: variant.inventory_quantity %}
{% endif %}
{% endfor %}
{% if product_qty > 0 %}        
{{ product_qty }} sold.
{% endif %}

 

Replies 0 (0)