<p>You can do the following:</p>
<pre><code>{{ variant.stock }}
</code></pre>

CC BY-SA 4.0
2021-03-16T01:32:21.200Z
2021-03-16T01:32:21.200Z
Luke Holder
<p>Like the question says. I know you can check if a variant is &quot;in stock&quot; with <code>v.hasStock</code>, but is there a way to pull the current stock quantity value?</p>
<p>In my particular situation I would like to do something like this:</p>
<p><code>&lt;input type=&quot;number&quot; min=&quot;0&quot; max=&quot;{{ variant.availableStock }} /&gt;</code></p>
<p>So as to prevent users from inputing a quantity that the store doesn't have.</p>

<plugin-craftcommerce3><variants>
Is there a way to get a variants stock quantity in commerce?
# Is there a way to get a variants stock quantity in commerce?

(Asked by: username_0 on 2021-03-15)

Like the question says. I know you can check if a variant is "in stock" with `v.hasStock`, but is there a way to pull the current stock quantity value?

In my particular situation I would like to do something like this:

`<input type="number" min="0" max="{{ variant.availableStock }} />`

So as to prevent users from inputing a quantity that the store doesn't have.

**Tags:** plugin-craftcommerce3, variants


---

## 1 answers

### Answer by username_1 on 2021-03-16. Score: 3 | Accepted answer

You can do the following:
{{ variant.stock }}


---

