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

Updating a variant while specifying same options causes it to conflict with itself #3190

Open
toBeOfUse opened this issue Nov 6, 2024 · 0 comments
Labels
type: bug 🐛 Something isn't working

Comments

@toBeOfUse
Copy link
Contributor

Describe the bug

In both the Admin API and when using the ProductVariantService directly, if you update a variant and specify that it should have the same options that it already has, there is an error that says that a variant with those options already exists. Instead, I think that updating a variant to have the same options that it already has should be a no-op. It makes it easier to update a variant when you can specify all of the properties that you want it to have, including the options, without triggering errors.

To Reproduce
Steps to reproduce the behavior:

  1. Create a variant.
  2. Use the updateProductVariants mutation from the Admin API, and specify the option IDs that the variant already has.
  3. There is an error.

Here is an example of updating a variant from the test data without specifying optionIds:

image

Here it is with specifying optionIDs:

image

Expected behavior
The update should succeed, since it won't cause any harm or inconsistency.

Environment (please complete the following information):

  • @vendure/core version: 3.0.5
  • Nodejs version: v20.14.0
  • Database (mysql/postgres etc): Postgres
@toBeOfUse toBeOfUse added the type: bug 🐛 Something isn't working label Nov 6, 2024
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
None yet
Development

No branches or pull requests

1 participant