<p>Got it:</p>

<pre><code>"price": ' . $order-&gt;totalDiscount . ',
</code></pre>

<p>^^</p>

CC BY-SA 4.0
2020-02-11T21:13:14.913Z
2020-02-11T21:13:14.913Z
Marcus Scheller
<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>

<plugin-development><craft3><plugin-craftcommerce2>
Getting adjustment amount in a plugin
# 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 . ',

^^


---

