E-commerce

Modeling product variants without confusing customers

Represent purchasable combinations accurately across product and cart pages.

Anant Dhiman · · 1 min read

Product configurator showing clothing variants and database relationships
On this page

A product can have several option dimensions, but not every combination necessarily exists or is in stock. A storefront should reflect actual variants rather than generate combinations independently.

Implementation approach

Use the platform’s variant identifier as the purchase target. Resolve the selected options against available variants and update price, availability and imagery from the resolved record.

Example

const variant = variants.find(v =>
  v.options.every((value, i) => value === selected[i])
);

Validation and edge cases

Test unavailable combinations, deep links to variants and inventory changes between selection and checkout. Confirm the cart receives the resolved variant rather than the parent product ID.

Key takeaway

Keep option labels accessible and distinguish an invalid combination from a valid but sold-out variant.

← All insights

Related articles