magento2: GraphQl Cart Errors not retreivable
If the cart has an error, (eg. because of too low stock), you can’t retrieve this error through GraphQl. The error is thrown when you try to place an order through GraphQl. But this is to late in the process.
Preconditions (*)
- Magento 2.3.4 Open Source
Steps to reproduce (*)
- Add a product to your cart through GraphQl
- Lower stock of product to below the amount in cart or set product out of stock.
- Retrieve Cart information through GraphQl.
Expected result (*)
- The ability to have access to the hasError value of the Cart
- The ability to have access to the errorInfo value of the CartItem
Actual result (*)
- Error information is unavailable through GraphQl.
{
"data": {
"cart": {
"prices": {
"grand_total": {
"currency": "USD",
"value": 34
}
},
"id": "Y4jQzWw93pta8ZLNEeBwygwQlQPbsEyB",
"items": [
{
"id": "5",
"quantity": 1,
"product": {
"name": "Joust Duffle Bag",
"sku": "24-MB01",
"description": {
"html": ""
}
}
}
]
}
}
}
Additional info
If try to View and Edit Cart from Storefront, error messages appear about Product out of stock

About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (13 by maintainers)
Commits related to this issue
- magento/magento2#26830 — committed to engcom-Charlie/magento2 by engcom-Charlie 4 years ago
@DrewML that is the case that @sasha19957099 demonstrated is now working as expected. The fix in #27015 fixed the CartItems resolver to handle errors (like product out of stock) in a better way.