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?

  • Is this for Commerce 1 or 2? You tagged both on the question.
    – Brad Bell
    Nov 20, 2018 at 3:37
  • @BradBell It's for Commerce 2, sorry about that!
    – benface
    Nov 20, 2018 at 21:26

1 Answer 1


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 }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.