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

Clicking on the 'Add to Cart' button multiple times quickly for an item that wasn't previously in cart messes up the count of the cart items. #2639

Closed
chygoz2 opened this issue Mar 22, 2019 · 5 comments
Labels
3: Medium complexity bug Bug reports P4: Nice to have Priority mark - it's nice to have QA approved after merge Testers will add this label after positive check on merged changes QA approved on branch Testers will add this label after positive check on specific branch.
Milestone

Comments

@chygoz2
Copy link

chygoz2 commented Mar 22, 2019

Current behavior

For a product that isn't already in cart, when the Add to cart button is clicked multiple times quickly without changing the quantity of the item via the quantity field, the count of items in the cart is usually more than what is expected after the cart sync with the server is completed.

If the cart is eventually converted to an order, there is also the tendency for the order to contain the same product as more than one line item.

Expected behavior

The quantity of a product in cart should be the same as the number of times the add to cart button is clicked for that product, provided that the quantity of the product isn't changed via the quantity field.

Steps to reproduce the issue

  1. Open the product detail page of a product that isn't already in cart
  2. Click the Add to cart button multiple times (click it at least 5 times in a second), leaving the quantity field unchanged.
  3. Watch the count of the items in cart for that product

Can you handle fixing this bug by yourself?

YES

Environment details

  • Browser: Google Chrome Version 73.0.3683.86 (Official Build) (64-bit)
  • OS: Windows 10 Pro
  • Node: v10.13.0
  • Code Version: Master

Additional information

Investigation revealed that this is due to the content of the request body sent to update an item's quantity on the server in the servercartAfterPulled action of the cart module. By clicking on the Add to cart button quickly multiple times, the request sent to the server causes the server to create the product in cart multiple times with different server_item_id

@pkarw
Copy link
Collaborator

pkarw commented Mar 23, 2019

Hi! Thanks for pointing this our, PR with a fix is more than welcome :)

@pkarw pkarw added bug Bug reports 3: Medium complexity P4: Nice to have Priority mark - it's nice to have labels Mar 23, 2019
@pkarw pkarw added this to the 1.10.0-rc.1 milestone Apr 16, 2019
@pkarw pkarw added the QA - Ready for tests This is notification for testers, that improvement is ready to be tested and verified. label Jun 3, 2019
@pkarw
Copy link
Collaborator

pkarw commented Jun 3, 2019

This should've been fixed by #2887 - can You please test it QA team? :)

@alinadivante
Copy link
Collaborator

@pkarw Please look at the counter on my gif..
my

@alinadivante alinadivante removed the QA - Ready for tests This is notification for testers, that improvement is ready to be tested and verified. label Jun 3, 2019
@pkarw pkarw added the QA - Ready for tests This is notification for testers, that improvement is ready to be tested and verified. label Jun 5, 2019
@pkarw
Copy link
Collaborator

pkarw commented Jun 5, 2019

Fixed in the #2887

@alinadivante
Copy link
Collaborator

I like this solution, which disable button for one moment on click to prevent multiple submits :)
It works! I added to my cart exactly as many items as I wanted

@alinadivante alinadivante added QA approved on branch Testers will add this label after positive check on specific branch. and removed QA - Ready for tests This is notification for testers, that improvement is ready to be tested and verified. labels Jun 6, 2019
@patzick patzick added the QA - Ready for tests This is notification for testers, that improvement is ready to be tested and verified. label Jun 11, 2019
@alinadivante alinadivante added QA approved after merge Testers will add this label after positive check on merged changes and removed QA - Ready for tests This is notification for testers, that improvement is ready to be tested and verified. labels Jun 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3: Medium complexity bug Bug reports P4: Nice to have Priority mark - it's nice to have QA approved after merge Testers will add this label after positive check on merged changes QA approved on branch Testers will add this label after positive check on specific branch.
Projects
None yet
Development

No branches or pull requests

4 participants