From 747f8a47b88c8818bee014f898a704a210a7caf0 Mon Sep 17 00:00:00 2001 From: Mathieu Date: Fri, 26 Jun 2026 09:47:14 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20handle=20'Stock=20(pi=C3=A8ce)'=20header?= =?UTF-8?q?=20variant=20in=20addition=20to=20'Stock=20(en=20pi=C3=A8ce)'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- src/app/api/creation/execute/route.ts | 1 + src/lib/creationSheets.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/api/creation/execute/route.ts b/src/app/api/creation/execute/route.ts index a8f469c..59da728 100644 --- a/src/app/api/creation/execute/route.ts +++ b/src/app/api/creation/execute/route.ts @@ -74,6 +74,7 @@ export async function POST(req: NextRequest) { famille: product.famille, }) send({ type: 'progress', current: i + 1, total, tab: product.tab, title: product.title, step: 'Création produit Shopify…' }) + console.log(`[creation] ${product.sku} stock=${product.stock}`) const shopifyId = await createShopifyProduct({ ref: product.sku, handle: product.sku.toLowerCase().replace(/[^a-z0-9]+/g, '-'), diff --git a/src/lib/creationSheets.ts b/src/lib/creationSheets.ts index 7856c54..b90fd3e 100644 --- a/src/lib/creationSheets.ts +++ b/src/lib/creationSheets.ts @@ -5,7 +5,7 @@ const COMMON_HEADERS = new Set([ 'Description courte', 'Description longue', 'Date de début de promo', 'Date de fin de promo', 'État de la TVA', 'Classe de TVA', 'En stock ?', - 'Stock (en pièce)', 'Stock conditionné', 'Vendre individuellement ?', + 'Stock (en pièce)', 'Stock (pièce)', 'Stock conditionné', 'Vendre individuellement ?', 'Prix marché', 'Prix remisé', 'Code ecopart', 'Ecopart montant', 'Famille', 'Sous famille', "Classe d'expédition (en retrait, livraison)", @@ -38,7 +38,7 @@ export function parseTabRows(tab: string, headers: string[], rows: string[][], d sku: findColIndex(headers, 'UGS'), nom: findColIndex(headers, 'Nom'), publie: findColIndex(headers, 'Publié'), - stock: findColIndex(headers, 'Stock (en pièce)'), + stock: findColIndex(headers, 'Stock (en pièce)') !== -1 ? findColIndex(headers, 'Stock (en pièce)') : findColIndex(headers, 'Stock (pièce)'), stockConditionne: findColIndex(headers, 'Stock conditionné'), prixMarche: findColIndex(headers, 'Prix marché'), prixRemise: findColIndex(headers, 'Prix remisé'),