mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
fix: update core charge appearance
Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
@@ -52,6 +52,9 @@ const productFragment = /* GraphQL */ `
|
||||
waiverAvailable: metafield(namespace: "custom", key: "waiver_available") {
|
||||
value
|
||||
}
|
||||
coreVariantId: metafield(namespace: "custom", key: "coreVariant") {
|
||||
value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -183,8 +183,9 @@ const reshapeImages = (images: Connection<Image>, productTitle: string) => {
|
||||
const reshapeVariants = (variants: ShopifyProductVariant[]): ProductVariant[] => {
|
||||
return variants.map((variant) => ({
|
||||
...variant,
|
||||
coreCharge: parseMetaFieldValue<Money>(variant.coreCharge),
|
||||
waiverAvailable: parseMetaFieldValue<boolean>(variant.waiverAvailable)
|
||||
waiverAvailable: parseMetaFieldValue<boolean>(variant.waiverAvailable),
|
||||
coreVariantId: variant.coreVariantId?.value || null,
|
||||
coreCharge: parseMetaFieldValue<Money>(variant.coreCharge)
|
||||
}));
|
||||
};
|
||||
|
||||
@@ -404,6 +405,18 @@ export async function getProduct(handle: string): Promise<Product | undefined> {
|
||||
return reshapeProduct(res.body.data.product, false);
|
||||
}
|
||||
|
||||
export async function getProductVariant(handle: string): Promise<Product | undefined> {
|
||||
const res = await shopifyFetch<ShopifyProductOperation>({
|
||||
query: getProductQuery,
|
||||
tags: [TAGS.products],
|
||||
variables: {
|
||||
handle
|
||||
}
|
||||
});
|
||||
|
||||
return reshapeProduct(res.body.data.product, false);
|
||||
}
|
||||
|
||||
export async function getProductRecommendations(productId: string): Promise<Product[]> {
|
||||
const res = await shopifyFetch<ShopifyProductRecommendationsOperation>({
|
||||
query: getProductRecommendationsQuery,
|
||||
|
@@ -87,11 +87,16 @@ export type ProductVariant = {
|
||||
waiverAvailable: boolean | null;
|
||||
barcode: string | null;
|
||||
sku: string | null;
|
||||
coreVariantId: string | null;
|
||||
};
|
||||
|
||||
export type ShopifyProductVariant = Omit<ProductVariant, 'coreCharge' | 'waiverAvailable'> & {
|
||||
coreCharge: { value: string } | null;
|
||||
export type ShopifyProductVariant = Omit<
|
||||
ProductVariant,
|
||||
'coreCharge' | 'waiverAvailable' | 'coreVariantId'
|
||||
> & {
|
||||
waiverAvailable: { value: string };
|
||||
coreVariantId: { value: string } | null;
|
||||
coreCharge: { value: string } | null;
|
||||
};
|
||||
|
||||
export type SEO = {
|
||||
|
Reference in New Issue
Block a user