Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

[Bug]: Cart quantity update fails even though updated quantity is available #502

Open
1 of 3 tasks
tobyj opened this issue Nov 8, 2021 · 0 comments
Open
1 of 3 tasks
Labels
bug Bug reports

Comments

@tobyj
Copy link

tobyj commented Nov 8, 2021

Describe the Bug

Cart quantity update appears to try and add the product quantity again as opposed to updating quantity of existing product. This means if there are scenarios where you cannot update the item quantity even though the desired quantity is valid.

This has been reproduced on vsf demo site.

Current behavior

Can ONLY increase/decrease currentQuantity of a product to requestedQuantity if the sum of currentQuantity and requestedQuantity is less than or equal to totalAvailableQty.

If (currentQuantity + requestedQuantity) <= totalAvailableQty - Quantity update will work. ✔️
If (currentQuantity + requestedQuantity) > totalAvailableQty - Quantity update will fail. ❌

e.g. for item X:
totalAvailableQty = 50 (the max that can be purchased)
currentQuantity = 40 (the quantity of item X I currently have in the cart)
requestedQuantity = 45 (the quantity of item X that I actually want)

(40 + 45) > 50 - the quantity update will fail ❌

... the only way to get to qty 45 would be to first reduce qty to 5 or less (45+5 <= 50), then change quantity back to 45

This bug also means you can't decrease the quantity of a product in some situations.
e.g. for item X above again - If I had 40 in cart, and wanted to decrease to 39 it will fail (because 40+39 > 50).

Expected behavior

Cart quantity updates from, for example, 40 to 45 items (where there are 50 in stock) should work but fails.

Steps to reproduce

Visit https://demo.vuestorefront.io/arcadio-gym-short.html?childSku=MSH11-32-Black

image

Note: At time of writing I could add a maximum quantity of 74.
Assuming the max available items is 74:

  1. Add quantity 74 to cart. This works, but you won't be able to adjust quantity up or down again.
    image
    image

  2. Try adjusting quantity down to 73. It fails. and reverts to 74.
    image

  3. Clear the cart so we can continue testing.

  4. Add quantity of 50 to cart.
    image

  5. Open cart and try adjusting quantity to 51. It will fail with error The requested qty is not available. (50+51 <= 74) and revert to 50. You should be able to update to 51 as we know there are 74 in stock
    image

  6. Try adjusting quantity to 25 - this too fails (50+25 > 74) You should be able to decrease quantity from 50 to 25

  7. Try adjusting quantity to 24 - this works because its under the total available quantity: (50+24 <= 74). Quantity is updated to 24.
    image

  8. Try adjusting quantity to 74 - this fails (24+74 > 74). Quantity is not updated

What version of Vue Storefront are you using?

1.12.2

What version of Node.js are you using?

14.17.6

What browser (and version) are you using?

Chrome

What operating system (and version) are you using?

MacOS

Relevant log output

No response

Able to fix / change the documentation?

  • Yes
  • No

Code of Conduct

  • I agree to follow this project's Code of Conduct
@tobyj tobyj added the bug Bug reports label Nov 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug reports
Projects
None yet
Development

No branches or pull requests

1 participant