Workflow: Product Variant Selection
Select color, choose size based on availability, update quantity, and add to cart.
Select Color
2
Choose Size3
Add to Cart


Classic Band Tee
€ 29,99
100% cotton vintage-style band tee with premium screen printing. Pre-shrunk for the perfect fit.
Select Color
1// Color selection2const [selectedColor, setSelectedColor] = useState<string>();3 4<ColorSelector5 colors={availableColors}6 selectedColor={selectedColor}7 onColorChange={setSelectedColor}8/>2Choose Size
1// Size selection based on color2const availableSizes = variants3 .filter(v => v.color === selectedColor)4 .map(v => ({5 size: v.size,6 available: v.inventory.available7 }));8 9<SizeSelector10 sizes={availableSizes}11 selectedSize={selectedSize}12 onSizeChange={setSelectedSize}13/>3Quantity & Add to Cart
Quantity:
1
1// Add to cart with selected variant2const { addItem } = useCart();3 4const handleAddToCart = async () => {5 await addItem({6 productId: product.id,7 variantId: selectedVariant.id,8 quantity,9 });10 toast.success('Added to cart!');11};