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
Labels
bug
Bug reports
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 to5
or less (45+5 <= 50
), then change quantity back to45
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
Note: At time of writing I could add a maximum quantity of
74
.Assuming the max available items is
74
:Add quantity
74
to cart. This works, but you won't be able to adjust quantity up or down again.Try adjusting quantity down to
73
. It fails. and reverts to 74.Clear the cart so we can continue testing.
Add quantity of
50
to cart.Open cart and try adjusting quantity to
51
. It will fail with errorThe requested qty is not available
. (50+51 <= 74) and revert to50
. You should be able to update to 51 as we know there are 74 in stockTry adjusting quantity to
25
- this too fails (50+25 > 74) You should be able to decrease quantity from 50 to 25Try adjusting quantity to
24
- this works because its under the total available quantity: (50+24 <= 74). Quantity is updated to 24.Try adjusting quantity to
74
- this fails (24+74 > 74). Quantity is not updatedWhat 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?
Code of Conduct
The text was updated successfully, but these errors were encountered: