Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AddToCard action not throwing an consumable response if product is out-of-stock #917

Open
danielkoch opened this issue Jun 2, 2022 · 5 comments
Labels
Done The work on the issue has finished

Comments

@danielkoch
Copy link

Expected Behaviour

If add to cart query is running against an out-of-stock product it should expose the error to the frontend. Otherwise it's impossible to implement a user interface an inform the user.

Actual Behaviour

Request that is trigged by the DOM event aem.cif.add-to-cart throw the following error:
AddToCartNoStock

Reproduce Scenario (including but not limited to)

Product must be out-of-stock

Steps to Reproduce

  1. Click on "Add to cart" on a product that is out-of-stock
  2. Inspect browser console
  3. Check cart amount (no changes)

Platform and Version

AEM v6.9
CIF components, v2.4.0
(Magento Cloud)

Sample Code that illustrates the problem

No example needed.

Logs taken while reproducing problem

Browser console see above.

@buuhuu
Copy link
Contributor

buuhuu commented Jun 2, 2022

@adobe export issue to Jira project CIF

@github-jira-sync-bot
Copy link
Collaborator

✅ Jira issue CIF-2904 is successfully created for this GitHub issue.

@buuhuu
Copy link
Contributor

buuhuu commented Jun 2, 2022

You are right, we have a mechanism for that for the wish list. Doing the same for add to cart would certainly be useful.

https://github.com/adobe/aem-core-cif-components/blob/master/react-components/src/talons/Wishlist/useAddToWishlistEvent.js#L46-L62

@danielkoch
Copy link
Author

danielkoch commented Jun 2, 2022

Thanks for the hint. Yes, similar solution in the "Add to Cart" event would be helpful. In addition: Also the name of the product itself in here: https://github.com/adobe/aem-core-cif-components/blob/master/ui.apps/src/main/content/jcr_root/apps/core/cif/components/commerce/product/v1/product/clientlib/js/addToCart.js#L117-L120 would help to build a helpful user-interface.

@buuhuu
Copy link
Contributor

buuhuu commented Sep 8, 2022

In addition: Also the name of the product itself
This will be added with https://github.com/adobe/aem-core-cif-components/pull/949/files#diff-d974f98a4343d70995ce10ca3ad8c97f28a5f99723ee5a63ff3d0f862f4f60af

@github-jira-sync-bot github-jira-sync-bot added in review Issue is in code review Done The work on the issue has finished and removed in review Issue is in code review labels Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Done The work on the issue has finished
Projects
None yet
Development

No branches or pull requests

3 participants