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é'),