Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-20T06:32:13.273Z
Answers.LastActivityDate: 2018-11-20T06:32:13.273Z
Answers.UserDisplayName: Luke Holder
Body: <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>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-20T03:37:28.180Z
Comments.Text: Is this for Commerce 1 or 2? You tagged both on the question.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-20T21:26:57.930Z
Comments.Text: @BradBell It's for Commerce 2, sorry about that!
Comments.UserDisplayName: benface
Tags: <craft3><plugin-craftcommerce><plugin-craftcommerce2>
Title: Get discount data from adjustment object
ThreadText: # 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**: @username_1 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 }}
  
  ```
  
  
  ---
  
  