When an item added to cart show a success message with product name and quantity added #3667
Unanswered
icreatestuff
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When a customer adds a product to their cart I need to be able to show a modal or similar that indicates the success including details about the specific product and quantity just added.
The
commerce/cart/update-cart
action provides a successful response but doesn't provide any detail about what was added as far as I can tell.A workaround that gets about 90% of the way is to pass the product ID from the current page to the modal and then loop over all the cart line items only outputting the one with a matching product ID. However, the quantity shown is the current total quantity of that item in the cart, rather than the quantity just added. I may have added 1 already and then subsequently added another. The modal should indicate that 1 was just added, but with my current implementation will show 2 just added.
Are there any existing ways to get something like this? Thanks
Beta Was this translation helpful? Give feedback.
All reactions