mirror of
https://github.com/vercel/commerce.git
synced 2025-06-18 21:21:21 +00:00
Fix missing categories & options
This commit is contained in:
parent
f4da360f12
commit
05c537e418
@ -27,7 +27,7 @@ export default function getSiteInfoOperation({
|
|||||||
const { sdkFetch } = commerce.getConfig(config)
|
const { sdkFetch } = commerce.getConfig(config)
|
||||||
const { data: categories } = await sdkFetch('categories', 'list')
|
const { data: categories } = await sdkFetch('categories', 'list')
|
||||||
|
|
||||||
const formattedCategories = categories.map(normalizeCategory)
|
const formattedCategories = categories?.map(normalizeCategory) ?? []
|
||||||
|
|
||||||
return {
|
return {
|
||||||
categories: formattedCategories,
|
categories: formattedCategories,
|
||||||
|
@ -54,6 +54,7 @@ export function normalizeProduct(
|
|||||||
): Product {
|
): Product {
|
||||||
const { id, name, description, permalink, assets, price, variant_groups } =
|
const { id, name, description, permalink, assets, price, variant_groups } =
|
||||||
commercejsProduct
|
commercejsProduct
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
@ -70,7 +71,10 @@ export function normalizeProduct(
|
|||||||
value: price.raw,
|
value: price.raw,
|
||||||
currencyCode: 'USD',
|
currencyCode: 'USD',
|
||||||
},
|
},
|
||||||
variants: normalizeVariants(commercejsProductVariants, variant_groups),
|
variants: normalizeVariants(
|
||||||
options: getOptionsFromVariantGroups(variant_groups),
|
commercejsProductVariants,
|
||||||
|
variant_groups || []
|
||||||
|
),
|
||||||
|
options: variant_groups ? getOptionsFromVariantGroups(variant_groups) : [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user