diff --git a/estore/src/components/ColorPicker.tsx b/estore/src/components/ColorPicker.tsx index 7c7dc4f..8047a9d 100644 --- a/estore/src/components/ColorPicker.tsx +++ b/estore/src/components/ColorPicker.tsx @@ -50,7 +50,9 @@ export default function ColorPicker({ product, maxColors, onClose, editingEntry const [notes, setNotes] = useState(editingEntry?.notes ?? '') const [activeImg, setActiveImg] = useState(0) const [userVariationId, setUserVariationId] = useState( - () => editingEntry?.selectedVariationId ?? product.variations[0]?.id + () => editingEntry?.selectedVariationId + ?? product.variations.find((v) => v.inventory === null || v.inventory > 0)?.id + ?? product.variations[0]?.id ) // Vinyl state @@ -285,21 +287,29 @@ export default function ColorPicker({ product, maxColors, onClose, editingEntry
- {selectableVariations.map((v) => ( - - ))} + {selectableVariations.map((v) => { + const varSoldOut = v.inventory !== null && v.inventory <= 0 + return ( + + ) + })}
)}