-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Closed
Copy link
Labels
Area: OrderComponent: GraphQLGraphQLGraphQLIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.A defect with this priority could have functionality issues which are not to expectations.Progress: PR CreatedIndicates that Pull Request has been created to fix issueIndicates that Pull Request has been created to fix issueProgress: doneReported on 2.4.8Indicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branch
Description
Preconditions and environment
Magento 2.4.8
Steps to reproduce
- Create a salesrule with a specific coupon code available for everyone with a discount amount
- Create a quote
- Apply this coupon
- Place the order
- Get the order using GraphQL with the "applied_coupons.code" node
query getOrderByNumber($orderNumber: String!) {
customer {
orders(filter: { number: { eq: $orderNumber } }) {
items {
orderNumber: number
applied_coupons {
code
}
}
}
}
}
Expected result
{
"data": {
"customer": {
"orders": {
"items": [
{
"orderNumber": "000000003",
"applied_coupons": [
{
"code": "h20"
}
]
}
]
}
}
}
}Actual result
{
"errors": [
{
"message": "Internal server error",
"locations": [
{
"line": 7,
"column": 11
}
],
"path": [
"customer",
"orders",
"items",
0,
"applied_coupons",
0,
"code"
],
"extensions": {
"debugMessage": "Cannot return null for non-nullable field \"AppliedCoupon.code\"."
}
}
],
"data": {
"customer": {
"orders": {
"items": [
{
"orderNumber": "000000003",
"applied_coupons": [
null
]
}
]
}
}
}
}Additional information
Because of \Magento\SalesGraphQl\Model\Formatter\Order::format()
'applied_coupons' => $orderModel->getCouponCode() ? ['code' => $orderModel->getCouponCode()] : []This should be encapsulate in an array
'applied_coupons' => $orderModel->getCouponCode() ? [['code' => $orderModel->getCouponCode()]] : [],Release note
GraphQL - fix issue while getting applied_coupons.code on order
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
thomas-kl1 and acourtiol
Metadata
Metadata
Assignees
Labels
Area: OrderComponent: GraphQLGraphQLGraphQLIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.A defect with this priority could have functionality issues which are not to expectations.Progress: PR CreatedIndicates that Pull Request has been created to fix issueIndicates that Pull Request has been created to fix issueProgress: doneReported on 2.4.8Indicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branch
Type
Projects
Status
Done