<p>An adjustment will take a snapshot of the source object that contained the rule for its application.</p>

<p>So the following is an array of a discounts attribute if you have a discount adjustment</p>

<pre><code>{{ adjustment.sourceSnapshot }}
</code></pre>

<p>You could get the coupon code with</p>

<pre><code>{{ adjustment.sourceSnapshot.code }}
</code></pre>

CC BY-SA 4.0
2018-11-20T06:32:13.273Z
2018-11-20T06:32:13.273Z
Luke Holder
<p>Is it possible to get, from one of the <code>cart.adjustments</code> of type <code>discount</code>, whether the discount was added with a coupon code, and if so, what that coupon code is?</p>

CC BY-SA 4.0
2018-11-20T03:37:28.180Z
Is this for Commerce 1 or 2? You tagged both on the question.
Brad Bell
CC BY-SA 4.0
2018-11-20T21:26:57.930Z
@BradBell It's for Commerce 2, sorry about that!
benface
<craft3><plugin-craftcommerce><plugin-craftcommerce2>
Get discount data from adjustment object
# Get discount data from adjustment object

(Asked by: username_0 on 2018-11-19)

Is it possible to get, from one of the `cart.adjustments` of type `discount`, whether the discount was added with a coupon code, and if so, what that coupon code is?

**Tags:** craft3, plugin-craftcommerce, plugin-craftcommerce2
> **Comments:**
> **username_1**: Is this for Commerce 1 or 2? You tagged both on the question.  
> **username_0**: @BradBell It's for Commerce 2, sorry about that!  

---

## 1 answers

### Answer by username_2 on 2018-11-20. Score: 2 | Accepted answer

An adjustment will take a snapshot of the source object that contained the rule for its application.
So the following is an array of a discounts attribute if you have a discount adjustment
{{ adjustment.sourceSnapshot }}

You could get the coupon code with
{{ adjustment.sourceSnapshot.code }}


---

