Limitations of variation finite option groups #4702
Closed
tbouliere-datasolution
started this conversation in
Feature Requests
Replies: 1 comment
|
Hi @tbouliere-datasolution - thank you for the clear explanation of the issue. I've created an issue out of this for further exploration and potential inclusion of some solution in our road map #5015 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Context
Vendure's data model assumes that variant axes are finite, enumerable sets. A variant must be uniquely identified by a tuple of
ProductOptionreferences, each tied to aProductOptionGroupdeclared on the parentProduct. Every value a customer might pick has to exist as a row inproduct_option.The validation in
ProductVariantService.validateVariantOptionIdsenforces three rules:optionIdsmatches the number of active option groups on the product.optionIdbelongs to exactly one of those groups.Rule (3) implicitly requires every variant to be discriminated by an enumerated tuple. This works well for products with a small, predefined set of choices (Size: S/M/L, Color: Red/Blue). It breaks down for catalogs where the natural variant axes are unbounded or continuous — and where pre-listing every value would either be impossible or grossly inefficient.
Concrete example: cardboard boxes
Consider a folding cardboard box catalog (e.g. RajaPack):
https://www.rajapack.at/kartons-schachteln-container/faltkartons-aus-wellpappe/faltkartons-1-wellig/braune-wellpapp-faltkartons-rajabox-1-wellig-braun-laenge-400-bis-500_OFF_DE_0140.html
A single product line ("brown corrugated folding box, 1-ply, length 400–500 mm") groups dozens of variants:
Every dimension is a continuous axis: any millimetre value is theoretically valid, even though the catalog only sells a discrete sample of them. The set is open-ended — adding a new size means adding a new value, not picking from a fixed list.
Modeling this in Vendure today is awkward:
ProductOptionrow with acodeand translations. Hundreds of options per dimension exist solely to satisfy the uniqueness constraint. Worse,ProductOptionGroupis channel-scoped and reusable across products — these dummy rows pollute the global option namespace.ProductOptionper variant per product. Same pollution problem, plus the group code (sku) leaks into the admin UI.error.product-variant-options-combination-already-exists).What the customer actually selects
For boxes, the customer rarely picks "length = 400" from a dropdown. They search by use case (book, parcel, A4) and either:
In both cases the storefront does not need a discrete option selector. Dimensions are attributes for display, filtering, and search — not selection axes from a finite set.
The semantic gap
Vendure's
ProductOptionGroupconflates two distinct concerns:The current
ProductOptionGrouponly fits the first. The second has no first-class concept and ends up either:The constraint we need to relax is not "the SKU should identify a variant" — it is "variant axes must be enumerated up front". Once that is dropped, the SKU (or any per-variant identifier) naturally takes over the discrimination role.
Proposal: free-input option group
A possible additive concept:
ProductOptionGroupwithinputMode: 'free'.string,int,float,boolean,length, ...) and an optional unit.ProductOptionrows are created upfront. Each variant stores its value inline (per variant, scoped to the group).All reactions