diff --git a/vendor/magento/module-sales-graph-ql/Model/Resolver/OrderTotal.php b/vendor/magento/module-sales-graph-ql/Model/Resolver/OrderTotal.php index 12963f9340ff4..494d09b9cd93a 100644 --- a/vendor/magento/module-sales-graph-ql/Model/Resolver/OrderTotal.php +++ b/vendor/magento/module-sales-graph-ql/Model/Resolver/OrderTotal.php @@ -1,7 +1,7 @@ [ 'value' => abs((float) $order->getDiscountAmount()), 'currency' => $order->getOrderCurrencyCode() - ] + ], + 'order_model' => $order ]; } return $orderDiscounts; diff --git a/vendor/magento/module-sales-rule-graph-ql/Model/Resolver/Coupon.php b/vendor/magento/module-sales-rule-graph-ql/Model/Resolver/Coupon.php index 0d4cdd5c5712b..5a7f56737bddd 100644 --- a/vendor/magento/module-sales-rule-graph-ql/Model/Resolver/Coupon.php +++ b/vendor/magento/module-sales-rule-graph-ql/Model/Resolver/Coupon.php @@ -33,6 +33,9 @@ public function __construct( */ public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) { + if (isset($value['order_model'])) { + return ['code' => $value['order_model']->getCouponCode()]; + } if (!isset($value['discount_model'])) { throw new LocalizedException(__('"discount_model" value should be specified')); }