pwa-studio
pwa-studio copied to clipboard
[feature]: Add additional user_errors parameter for cart addition and show error message if reported by Adobe Commerce.
Currently, Minicart does not report errors if Add to cart graphql mutation fails to add the product to the cart due to some validation ( like Product not sellable, insufficient inventory. )
if there is
user_errors {
code
message
}
added in graphql request , Adobe Commerce responds with code and message like :
"user_errors": [
{
"code": "NOT_SALABLE",
"message": "Product that you are trying to add is not available."
}
]
This error should also be propagated on UI.
Adobe Commerce Add to cart Mutation (search user_errors on page) : https://devdocs.magento.com/guides/v2.4/graphql/mutations/add-products-to-cart.html#errors
ADD_TO_CART_MUTATION does not contain this field in PWA studio.
Commerce Integration Framework will be replacing the current cart with this peregrine-based cart in the future, so this should be fixed so that there is consistent reporting of errors from Adobe commerce to UI.
Add to Cart mutation in pergerine : https://github.com/magento/pwa-studio/blob/b1a07acaec0aca2b267684392e7fddc7cb868362/packages/peregrine/lib/talons/AddToCartDialog/addToCartDialog.gql.js
- [ ]
venia-concept
- [x]
venia-ui
- [ ]
pwa-buildpack
- [x]
peregrine
- [ ]
pwa-devdocs
- [ ]
upward-js
- [ ]
upward-spec
- [ ]
create-pwa
Hi @AKumarSingh. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this
- Join Magento Community Engineering Slack and ask your questions in #github channel.
@adobe export issue to JIRA project PWA as Story
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/PWA-2983 is successfully created for this GitHub issue.
@magento I am working on this
Hi @AKumarSingh , Could you please provide us with the steps to reproduce the issue in UI?
This issue is reproducible