mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
feat: adding more information warranty, part number, sku, speciall offers
Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
@@ -36,6 +36,8 @@ const productFragment = /* GraphQL */ `
|
||||
id
|
||||
title
|
||||
availableForSale
|
||||
barcode
|
||||
sku
|
||||
selectedOptions {
|
||||
name
|
||||
value
|
||||
@@ -68,6 +70,9 @@ const productFragment = /* GraphQL */ `
|
||||
}
|
||||
tags
|
||||
updatedAt
|
||||
productType: metafield(namespace: "custom", key: "product_type") {
|
||||
value
|
||||
}
|
||||
}
|
||||
${imageFragment}
|
||||
${seoFragment}
|
||||
|
@@ -193,12 +193,12 @@ const reshapeProduct = (product: ShopifyProduct, filterHiddenProducts: boolean =
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const { images, variants, ...rest } = product;
|
||||
|
||||
const { images, variants, productType, ...rest } = product;
|
||||
return {
|
||||
...rest,
|
||||
images: reshapeImages(images, product.title),
|
||||
variants: reshapeVariants(removeEdgesAndNodes(variants))
|
||||
variants: reshapeVariants(removeEdgesAndNodes(variants)),
|
||||
productType: productType?.value ?? null
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -62,9 +62,10 @@ export type Page = {
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
export type Product = Omit<ShopifyProduct, 'variants' | 'images'> & {
|
||||
export type Product = Omit<ShopifyProduct, 'variants' | 'images' | 'productType'> & {
|
||||
variants: ProductVariant[];
|
||||
images: Image[];
|
||||
productType: string | null;
|
||||
};
|
||||
|
||||
export type ProductOption = {
|
||||
@@ -84,6 +85,8 @@ export type ProductVariant = {
|
||||
price: Money;
|
||||
coreCharge: Money | null;
|
||||
waiverAvailable: boolean | null;
|
||||
barcode: string | null;
|
||||
sku: string | null;
|
||||
};
|
||||
|
||||
export type ShopifyProductVariant = Omit<ProductVariant, 'coreCharge' | 'waiverAvailable'> & {
|
||||
@@ -140,6 +143,9 @@ export type ShopifyProduct = {
|
||||
handle: string;
|
||||
}[];
|
||||
};
|
||||
productType: {
|
||||
value: string;
|
||||
} | null;
|
||||
};
|
||||
|
||||
export type ShopifyCartOperation = {
|
||||
|
Reference in New Issue
Block a user