Answers.Body: <p>Got it:</p>
  
  <pre><code>"price": ' . $order-&gt;totalDiscount . ',
  </code></pre>
  
  <p>^^</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-11T21:13:14.913Z
Answers.LastActivityDate: 2020-02-11T21:13:14.913Z
Answers.UserDisplayName: Marcus Scheller
Body: <p>I need to get the amount of a discount from orders to write that data into a json file (on EVENT_AFTER_COMPLETE_ORDER) which then will be consumed by an inventory management system and now am stuck with discount amounts. Currently I have:</p>
  
  <pre><code>"price": ' . $order-&gt;adjustment-&gt;one-&gt;type('discount')-&gt;amount . ',
  </code></pre>
  
  <p>which does not work. Could anyone help on how to do this and maybe point me to the documentation where I could read up on it?</p>
  
  <p>Thanks
  m</p>
  
Tags: <plugin-development><craft3><plugin-craftcommerce2>
Title: Getting adjustment amount in a plugin
ThreadText: # Getting adjustment amount in a plugin
  
  (Asked by: username_0 on 2020-02-11)
  
  I need to get the amount of a discount from orders to write that data into a json file (on EVENT\_AFTER\_COMPLETE\_ORDER) which then will be consumed by an inventory management system and now am stuck with discount amounts. Currently I have:
  
  ```
  "price": ' . $order->adjustment->one->type('discount')->amount . ',
  
  ```
  
  which does not work. Could anyone help on how to do this and maybe point me to the documentation where I could read up on it?
  
  Thanks
  m
  
  **Tags:** plugin-development, craft3, plugin-craftcommerce2
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-02-11. Score: 1
  
  Got it:
  
  ```
  "price": ' . $order->totalDiscount . ',
  
  ```
  
  ^^
  
  
  ---
  
  