mirror of
https://github.com/vercel/commerce.git
synced 2025-06-18 21:21:21 +00:00
Adding support for default options and removing the one that we do not need
This commit is contained in:
parent
9669c426e0
commit
a6cbd3d581
@ -39,7 +39,6 @@ const ProductView: FC<Props> = ({ product }) => {
|
|||||||
})
|
})
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
console.log(product.variants[0])
|
|
||||||
const variant = getVariant(product, choices)
|
const variant = getVariant(product, choices)
|
||||||
|
|
||||||
const addToCart = async () => {
|
const addToCart = async () => {
|
||||||
|
@ -96,7 +96,11 @@ export function normalizeProduct(productNode: ShopifyProduct): Product {
|
|||||||
price: money(priceRange?.minVariantPrice),
|
price: money(priceRange?.minVariantPrice),
|
||||||
images: normalizeProductImages(images),
|
images: normalizeProductImages(images),
|
||||||
variants: variants ? normalizeProductVariants(variants) : [],
|
variants: variants ? normalizeProductVariants(variants) : [],
|
||||||
options: options ? options.map((o) => normalizeProductOption(o)) : [],
|
options: options
|
||||||
|
? options
|
||||||
|
.filter((o) => o.name !== 'Title') // By default Shopify adds a 'Title' name when there's only one option. We don't need it.
|
||||||
|
.map((o) => normalizeProductOption(o))
|
||||||
|
: [],
|
||||||
...rest,
|
...rest,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user