Skip to content
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

Stock validation not working as expected with OrderLine custom fields #2702

Closed
andriinuts opened this issue Feb 27, 2024 · 0 comments
Closed
Assignees
Labels
type: bug 🐛 Something isn't working

Comments

@andriinuts
Copy link
Contributor

andriinuts commented Feb 27, 2024

Describe the bug
Stock validation not working as expected when you are adding two of the same variants but with different custom field values.
For example, you have Variant A with tracked inventory, and in stock, you have only 1. You are calling addItemToOrder with Variant A and custom field value 1 and then calling addItemToOrder with the same Variant A but custom field value as 2. Now in order you have 2 order lines (the same variant with different custom fields, which are expected if it's available such as count of stock but not in this example when we have only 1 available stock).

To Reproduce
Steps to reproduce the behavior:

  1. Create a custom field for OrderLine (for example customField with type string)
  2. Create a Variant A with manageable stock and stock count 1
  3. Create an order and add a Variant A with custom field value 1
  4. Add one more time Variant A but now with custom field value 2
  5. You successfully added more than the in-stock available items.

Expected behavior
Receiving an error that no possibility to add more of the Variant A to the order.

Environment (please complete the following information):

  • @vendure/core version: 2.1.7
  • Nodejs version: v20.10
  • Database (mysql/postgres etc): any

Additional context
Also, you can fulfill this order (from steps to reproduce) and then you will have a negative stock value (-1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
Status: 🚀 Shipped
Development

No branches or pull requests

2 participants