mirror of
https://github.com/vercel/commerce.git
synced 2025-06-20 06:01:21 +00:00
saleor: fix the variants
This commit is contained in:
parent
3b559e9853
commit
42ae126b7b
@ -32,10 +32,11 @@ const ProductView: FC<Props> = ({ product }) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Selects the default option
|
// Selects the default option
|
||||||
product.variants[0].options?.forEach((v) => {
|
const options = product.variants[0].options || [];
|
||||||
|
options.forEach((v) => {
|
||||||
setChoices((choices) => ({
|
setChoices((choices) => ({
|
||||||
...choices,
|
...choices,
|
||||||
[v.displayName.toLowerCase()]: v.values[0].label.toLowerCase(),
|
[v.displayName.toLowerCase()]: v.values[0]?.label.toLowerCase(),
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
}, [])
|
}, [])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user