<p>This should do what you're looking for:</p>

<pre><code>craft.commerce.discounts.getAllDiscounts()
</code></pre>

<p><code>craft.commerce.discounts</code> is a reference to <a href="https://github.com/craftcms/commerce/blob/develop/src/services/Discounts.php" rel="nofollow noreferrer"><code>services/Discounts</code></a>, so you've got access to all of the public methods in there, of which <code>getAllDiscounts()</code> is one.</p>

CC BY-SA 4.0
2018-05-31T17:12:00.327Z
2018-05-31T17:12:00.327Z
Brad Bell
<p>I would like to retrieve all available discounts for an eshop using the Craft Commerce v2.
In Craft Commerce v1, I could use the following:</p>

<pre><code>craft.commerce.discounts.all()
</code></pre>

<p>However, I can't find an equivalent method for Commerce v2</p>

<p>Can anyone please help?</p>

<plugin-craftcommerce><plugin-craftcommerce2>
Is there a way to retrieve discounts for a product in Craft Commerce v2?
# Is there a way to retrieve discounts for a product in Craft Commerce v2?

(Asked by: username_0 on 2018-05-31)

I would like to retrieve all available discounts for an eshop using the Craft Commerce v2.
In Craft Commerce v1, I could use the following:
craft.commerce.discounts.all()

However, I can't find an equivalent method for Commerce v2
Can anyone please help?

**Tags:** plugin-craftcommerce, plugin-craftcommerce2

---

## 1 answers

### Answer by username_1 on 2018-05-31. Score: 0 | Accepted answer

This should do what you're looking for:
craft.commerce.discounts.getAllDiscounts()

craft.commerce.discounts is a reference to services/Discounts, so you've got access to all of the public methods in there, of which getAllDiscounts() is one.


---

