-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Describe the bug
It's possible to buy items that are out of stock if they were added to the cart (added to an active order) before they went out of stock.
To Reproduce
Steps to reproduce the behavior:
- Consider User A, User B and Item C with a quantity of 20
- User A puts 5 items in their cart
- User B puts 20 items in his their and checks out
- After the items have been bought and the stock is depleted, User A can still check out and buy the things in their cart
- Saleable stock is negative and the item was oversold
Expected behavior
The shop API should refuse the purchasing of the items and throw an error, forcing User A to take action and to adjust their cart
Environment (please complete the following information):
- @vendure/core version: 1.6.5
- Nodejs version: 16 LTS
- Database (mysql/postgres etc): postgres
- Inventory tracking through vendure is enabled
Additional context
Other variations are possible, e.g. User B does not need to buy the entire stock, just enough so that whatever User B will buy is not fully available anymore.
A potential workaround was discussed through the implementation of a CustomOrderProcess that uses the onTransitionStart hook to check stock levels before the order changes state to ArrangingPayment.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status