Skip to content

Commit f0c0cce

Browse files
committed
fixed ProductForm for products with no variants
1 parent c8511a9 commit f0c0cce

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/ProductForm/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ const ProductForm = ({ product }) => {
3030
const result = fetchedProduct.variants.filter(
3131
variant => variant.id === productVariant.shopifyId
3232
)
33-
if (result.length > 0) {
34-
setAvailable(result[0].available)
35-
}
33+
setAvailable(
34+
result[0]?.available ?? fetchedProduct.variants[0].available
35+
)
3636
})
3737
},
3838
[client.product, productVariant.shopifyId]

0 commit comments

Comments
 (0)