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.




