mirror of
https://github.com/vercel/commerce.git
synced 2025-05-17 06:56:59 +00:00
Finish migration
This commit is contained in:
parent
e5ebf60e83
commit
ef8bb5914e
@ -10,6 +10,7 @@ import {
|
|||||||
SelectedOptions,
|
SelectedOptions,
|
||||||
} from '../helpers'
|
} from '../helpers'
|
||||||
import { Box, Stack, Text as ChakraText } from '@chakra-ui/react'
|
import { Box, Stack, Text as ChakraText } from '@chakra-ui/react'
|
||||||
|
import { Metafield } from '@commerce/types/common'
|
||||||
|
|
||||||
import productDetailsMetafields from '../../../static_data/productDetailsMetafields.json'
|
import productDetailsMetafields from '../../../static_data/productDetailsMetafields.json'
|
||||||
|
|
||||||
@ -43,8 +44,6 @@ const ProductSidebar: FC<ProductSidebarProps> = ({ product, className }) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(product.metafields!.custom)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={className}>
|
<div className={className}>
|
||||||
<ProductOptions
|
<ProductOptions
|
||||||
@ -57,7 +56,7 @@ const ProductSidebar: FC<ProductSidebarProps> = ({ product, className }) => {
|
|||||||
|
|
||||||
<Box>
|
<Box>
|
||||||
<Stack>
|
<Stack>
|
||||||
{productDetailsMetafields.metafields[0].names.map((meta) => (
|
{productDetailsMetafields.metafields[0].names.map((meta: any) => (
|
||||||
<Box key={meta.key}>
|
<Box key={meta.key}>
|
||||||
<ChakraText
|
<ChakraText
|
||||||
as={'span'}
|
as={'span'}
|
||||||
@ -67,9 +66,7 @@ const ProductSidebar: FC<ProductSidebarProps> = ({ product, className }) => {
|
|||||||
{meta.name}:{' '}
|
{meta.name}:{' '}
|
||||||
</ChakraText>
|
</ChakraText>
|
||||||
<ChakraText as={'span'}>
|
<ChakraText as={'span'}>
|
||||||
{product.metafields.custom
|
{product.metafields!.custom[meta.key as keyof Metafield].value}
|
||||||
.filter((o) => o.key == meta.key)
|
|
||||||
.map((o) => o.value)}
|
|
||||||
</ChakraText>
|
</ChakraText>
|
||||||
</Box>
|
</Box>
|
||||||
))}
|
))}
|
||||||
|
@ -31,8 +31,6 @@ export async function getStaticProps({
|
|||||||
const pagesPromise = commerce.getAllPages({ config, preview })
|
const pagesPromise = commerce.getAllPages({ config, preview })
|
||||||
const siteInfoPromise = commerce.getSiteInfo({ config, preview })
|
const siteInfoPromise = commerce.getSiteInfo({ config, preview })
|
||||||
|
|
||||||
console.log(withMetafields)
|
|
||||||
|
|
||||||
const productPromise = commerce.getProduct({
|
const productPromise = commerce.getProduct({
|
||||||
variables: {
|
variables: {
|
||||||
slug: params!.slug,
|
slug: params!.slug,
|
||||||
@ -52,8 +50,6 @@ export async function getStaticProps({
|
|||||||
const { product } = await productPromise
|
const { product } = await productPromise
|
||||||
const { products: relatedProducts } = await allProductsPromise
|
const { products: relatedProducts } = await allProductsPromise
|
||||||
|
|
||||||
console.log(product)
|
|
||||||
|
|
||||||
if (!product) {
|
if (!product) {
|
||||||
return {
|
return {
|
||||||
notFound: true,
|
notFound: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user