Skip to content

Stock service needs to take into account if the current stock is null #699

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

Closed
mattbrailsford opened this issue Apr 30, 2025 · 1 comment
Closed

Comments

@mattbrailsford
Copy link
Contributor

mattbrailsford commented Apr 30, 2025

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

@mattbrailsford
Copy link
Contributor Author

Fixed it in 15.3.2.

Updated the UmbracoStockService to return an Unknown stock source if it resolves to a product, but if the product doesn't have a stock property on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant