From 20b79bd7514bc030d834add590bfcdc6c59d533c Mon Sep 17 00:00:00 2001 From: jrphilo Date: Fri, 12 Jul 2024 09:14:15 +0200 Subject: [PATCH] feat: add supplier return to productVariant Signed-off-by: jrphilo --- lib/shopify/fragments/product.ts | 3 +++ lib/shopify/index.ts | 1 + lib/shopify/types.ts | 3 +++ 3 files changed, 7 insertions(+) diff --git a/lib/shopify/fragments/product.ts b/lib/shopify/fragments/product.ts index d3e8b4e9d..a7358b305 100644 --- a/lib/shopify/fragments/product.ts +++ b/lib/shopify/fragments/product.ts @@ -62,6 +62,9 @@ const productFragment = /* GraphQL */ ` mileage: metafield(namespace: "custom", key: "mileage") { value } + supplier: metafield(namespace: "custom", key: "supplier") { + value + } condition: metafield(namespace: "custom", key: "condition") { value } diff --git a/lib/shopify/index.ts b/lib/shopify/index.ts index c3f049e8f..d079c798f 100644 --- a/lib/shopify/index.ts +++ b/lib/shopify/index.ts @@ -477,6 +477,7 @@ const reshapeVariants = (variants: ShopifyProductVariant[]): ProductVariant[] => coreVariantId: variant.coreVariantId?.value || null, coreCharge: parseMetaFieldValue(variant.coreCharge), mileage: variant.mileage?.value ?? null, + supplier: variant.supplier?.value || null, estimatedDelivery: variant.estimatedDelivery?.value || null, condition: variant.condition?.value || null, ...(addOnProductId diff --git a/lib/shopify/types.ts b/lib/shopify/types.ts index c259cd462..614f35fdc 100644 --- a/lib/shopify/types.ts +++ b/lib/shopify/types.ts @@ -459,6 +459,7 @@ export type ProductVariant = { coreVariantId: string | null; mileage: number | null; estimatedDelivery: string | null; + supplier: string | null; condition: string | null; engineCylinders: string | null; fuelType: string | null; @@ -489,6 +490,7 @@ export type ShopifyProductVariant = Omit< | 'coreVariantId' | 'mileage' | 'estimatedDelivery' + | 'supplier' | 'condition' | 'addOnProduct' > & { @@ -497,6 +499,7 @@ export type ShopifyProductVariant = Omit< coreCharge: { value: string } | null; mileage: { value: number } | null; estimatedDelivery: { value: string } | null; + supplier: { value: string } | null; condition: { value: string } | null; addOnProductId: { value: string } | null; addOnQuantity: { value: string } | null;