pwa-studio icon indicating copy to clipboard operation
pwa-studio copied to clipboard

[feature]: Add additional user_errors parameter for cart addition and show error message if reported by Adobe Commerce.

Open AKumarSingh opened this issue 2 years ago • 3 comments

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

AKumarSingh avatar Sep 05 '22 10:09 AKumarSingh

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


m2-assistant[bot] avatar Sep 05 '22 10:09 m2-assistant[bot]

@adobe export issue to JIRA project PWA as Story

anthoula avatar Sep 06 '22 15:09 anthoula

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/PWA-2983 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Sep 06 '22 15:09 github-jira-sync-bot

@magento I am working on this

justinconabree avatar Apr 14 '23 14:04 justinconabree

Hi @AKumarSingh , Could you please provide us with the steps to reproduce the issue in UI?

glo80771 avatar Jul 27 '23 09:07 glo80771

This issue is reproducible

glo82145 avatar Sep 14 '23 05:09 glo82145