-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Which component is this issue related to?
Umbraco Commerce (Core)
Which Umbraco Commerce version are you using? (Please write the exact version, example: 10.1.0)
15.3.1
Bug summary
It is possible for stock to be set for a node even if it doesn't have a stock property editor. This causes issues with the new stock validators.
Specifics
We have a stock syncronizer that syncs the product stock value to a database table, however we also have code elsewhere such as in event handlers that reacts to items being re-funded and restocked. The issue is the restocking doesn't take into account whether we actually maintain stock for that product and so it just increments the stock level in the DB. This can then cause an exception where if that product is then purchased reducing the stock to 0, it then triggers the validation logic that prevents an item being added to the cart if it exceeds the stock level.
Steps to reproduce
- Create a product node with no stock property editor
- Create an order with that product in and finalized it
- Refund that order restocking the items
- Create an order with 2 of that products in a cart
- Validation exception is thrown
Expected result / actual result
If the product node isn't tracking stock, then it shouldn't be updated we restocking
Dependencies
No response
This item has been added to our backlog AB#52402