feat: adding more information warranty, part number, sku, speciall offers

Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
Chloe
2024-04-25 14:14:20 +07:00
parent e3f564ca77
commit 59c3f07beb
14 changed files with 215 additions and 85 deletions

View File

@@ -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}

View File

@@ -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
};
};

View File

@@ -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 = {