From f0b6ddf145db33141238b9c16128e20f6b3962a4 Mon Sep 17 00:00:00 2001 From: Mathieu Date: Tue, 9 Jun 2026 21:54:41 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20propager=20le=20type=20r=C3=A9el=20du=20?= =?UTF-8?q?m=C3=A9tachamp=20Shopify=20pour=20=C3=A9viter=20les=20erreurs?= =?UTF-8?q?=20422?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/shopifyMetafields.ts | 4 ++-- src/types/creation.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/shopifyMetafields.ts b/src/lib/shopifyMetafields.ts index 175fcac..997bf17 100644 --- a/src/lib/shopifyMetafields.ts +++ b/src/lib/shopifyMetafields.ts @@ -35,7 +35,7 @@ export function matchMetafields(columnHeaders: string[], definitions: MetafieldD const key = normalizeMetafieldKey(header) const def = definitions.find(d => d.key === key) if (def) { - matched[header] = { columnHeader: header, action: 'map', namespace: def.namespace, key: def.key, existingDefinitionId: def.id } + matched[header] = { columnHeader: header, action: 'map', namespace: def.namespace, key: def.key, type: def.type, existingDefinitionId: def.id } } else { unmatched.push(header) } @@ -149,7 +149,7 @@ export async function setProductMetafield( method: 'POST', headers, body: JSON.stringify({ - metafield: { namespace: resolution.namespace, key: resolution.key, value, type: 'single_line_text_field' }, + metafield: { namespace: resolution.namespace, key: resolution.key, value, type: resolution.type ?? 'single_line_text_field' }, }), }) if (!res.ok) { diff --git a/src/types/creation.ts b/src/types/creation.ts index b36e249..2e10825 100644 --- a/src/types/creation.ts +++ b/src/types/creation.ts @@ -33,6 +33,7 @@ export interface MetafieldResolution { action: 'create' | 'map' | 'skip' namespace: string // "custom" par défaut key: string // clé normalisée + type?: string // type Shopify réel, ex: 'multi_line_text_field', 'number_decimal' existingDefinitionId?: string // si action === 'map' }