Pull in stock from Craft Commerce cart
Assuming your lineItem variable is called item, you're looking for

item.purchasable.stock

You might also need to pay attention to maxQty which is the maximum number of a purchasable item that a user is allowed to buy. I limit customers to a maximum of 10 and create a select box on the basket form with a Remove option at the bottom:

{% set maxQuantity = item.purchasable.stock &gt; 10 ? 10 : item.purchasable.stock %}
{% if item.purchasable.maxQty %}
    {% set maxQuantity = maxQuantity &gt; item.purchasable.maxQty ? item.purchasable.maxQty : maxQuantity %}
{% endif %}

&lt;select name="qty"&gt;
    {% for i in 1..maxQuantity %}
        &lt;option value="{{ i }}" {{ i == item.qty ? 'selected' }}&gt;{{ i }}&lt;/option&gt;
    {% endfor %}
    &lt;option value="0"&gt;Remove&lt;/option&gt;
&lt;/select&gt;