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

Can't create more than one product variant without option group #2210

Closed
munxar opened this issue Jun 8, 2023 · 3 comments
Closed

Can't create more than one product variant without option group #2210

munxar opened this issue Jun 8, 2023 · 3 comments
Assignees
Labels
type: bug 🐛 Something isn't working

Comments

@munxar
Copy link

munxar commented Jun 8, 2023

Describe the bug
When I try to create a product variant manually, only the first variant can be created. After this an error is displayed that that (name of the first variant) allredy exists.

To Reproduce
Steps to reproduce the behavior:

  1. install vendure, without seed data
  2. login to /admin backend
  3. create a product
  4. go to manage variants
  5. define no option group
  6. add a product variant e.g. name: var1 sku: 100 (success)
  7. add another product variant e.g. name: var2 sku:101 (error)
    frontend error: A ProductVariant with the selected options already exists: var1
    backend error: USER_INPUT_ERROR: error.product-variant-options-combination-already-exists

Expected behavior
No error, var2 should be created.

Environment (please complete the following information):

  • @vendure/core 2.0.0:
  • Nodejs version 16.17.1
  • Database (mysql/postgres etc): postgres 14.7
@munxar munxar added the type: bug 🐛 Something isn't working label Jun 8, 2023
@munxar munxar changed the title Can't create more than one product variant Can't create more than one product variant without option group Jun 8, 2023
@habibullahturkmen
Copy link

I'm having the same issue when creating a variant without an option group (Vendure v2).

@michaelbromley
Copy link
Member

Hi, thanks for the report. This is more of a UX issue - the UI is not clearly communicating the constraints here:

  • ProductVariants are based on ProductOption combinations.
  • So if a Product has no OptionGroups defined, it by definition can only have a single variant.
  • The correct flow for adding more variants would be:
    1. Add a product option group
    2. Add two or more options to the group
    3. Create the variant(s) desired based on the available options.

I'll see how I can make this more clear in the UI.

@michaelbromley michaelbromley moved this from 📋 Backlog to ✅ Done in Vendure OS Roadmap Jul 27, 2023
@arjunmurali1993
Copy link

Hi, thanks for the report. This is more of a UX issue - the UI is not clearly communicating the constraints here:

  • ProductVariants are based on ProductOption combinations.

  • So if a Product has no OptionGroups defined, it by definition can only have a single variant.

  • The correct flow for adding more variants would be:

    1. Add a product option group
    2. Add two or more options to the group
    3. Create the variant(s) desired based on the available options.

I'll see how I can make this more clear in the UI.

Quick question regarding the above @michaelbromley .

Do we need to create ProductOptionGroups and corresponding ProductOptions for each separate Product before we can create the required ProductVariants for that Product?

For example, if I create colours ProductOptionGroup with values Black, Red for product T Shirt 1, can I not reuse the same for another product T Shirt 2? Or is this not possible?

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

4 participants