mirror of
https://github.com/vercel/commerce.git
synced 2025-06-18 13:11:23 +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 { data: categories } = await sdkFetch('categories', 'list')
|
||||
|
||||
const formattedCategories = categories.map(normalizeCategory)
|
||||
const formattedCategories = categories?.map(normalizeCategory) ?? []
|
||||
|
||||
return {
|
||||
categories: formattedCategories,
|
||||
|
@ -54,6 +54,7 @@ export function normalizeProduct(
|
||||
): Product {
|
||||
const { id, name, description, permalink, assets, price, variant_groups } =
|
||||
commercejsProduct
|
||||
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
@ -70,7 +71,10 @@ export function normalizeProduct(
|
||||
value: price.raw,
|
||||
currencyCode: 'USD',
|
||||
},
|
||||
variants: normalizeVariants(commercejsProductVariants, variant_groups),
|
||||
options: getOptionsFromVariantGroups(variant_groups),
|
||||
variants: normalizeVariants(
|
||||
commercejsProductVariants,
|
||||
variant_groups || []
|
||||
),
|
||||
options: variant_groups ? getOptionsFromVariantGroups(variant_groups) : [],
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user