Skip to content

PRD: Product options & variant generation

ModuleProductsPRD IDPRD-OPT-002
StatusReady to devFEATOPT
EpicPlaneBANA-1555
Date2026-06-15Versionv1.0
Packages@nx/commerce · @nx/coreURDOPT
SurfaceClient · Owner/Mgr
OwnerPhát Nguyễn

What product options & variant generation is

The option binding model defines what a variant's combination is and keeps it valid and unique - but not how a product and its full set of option-bearing variants come to exist in one owner action.

This PRD turns a product's option axes into the exact variants a merchant sells - in one atomic create. The owner declares the axes (size, ice, colour) and names each variant, choosing its value per axis; the system builds every option, value, variant, binding, identifier, and inventory attribute together, resolves one default, and makes each variant findable by its options in search.

Why a dedicated generation path is needed

Without a generation path, the owner builds the catalogue piecemeal: create a bare product, add each variant, attach options one at a time. Every round-trip is a chance to leave it half-built - axes with no variants, a variant with no default, a barcode clash found only on the third try.

TraitMeaning
ExplicitOnly the declared variants exist, never a full cartesian matrix
AtomicOptions, values, variants, bindings, identifiers, inventory attributes, and one default are one unit - all changes land, or none do
DefaultWhichever variant the owner flags, or the first declared if none

One product, from declaring axes to ready-to-sell

An owner creates a milk tea with axes Size (S/M/L) and Ice (100/50/0), declares the five variants actually sold, and flags "M, 100% ice" as default. In one atomic step the system builds the axes, values, five variants, their bindings, identifiers, and inventory attributes; the flagged variant becomes default; each is immediately findable in search by its size and ice.

Declaring two defaults, or two variants with the same barcode, is refused before anything is saved.

Where this is easy to get wrong

The suggestion screen is not the system persisting the matrix

The Generate Variants screen on the Client app still suggests the full axis matrix as an editing convenience so the owner can prune/add before saving - that's a screen affordance to help the owner move faster, not the system persisting the whole matrix. Only the variants the owner keeps at save time are actually created; whatever is deleted on screen never reaches the system.

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.