fix: handle 'Stock (pièce)' header variant in addition to 'Stock (en pièce)'
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -74,6 +74,7 @@ export async function POST(req: NextRequest) {
|
|||||||
famille: product.famille,
|
famille: product.famille,
|
||||||
})
|
})
|
||||||
send({ type: 'progress', current: i + 1, total, tab: product.tab, title: product.title, step: 'Création produit Shopify…' })
|
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({
|
const shopifyId = await createShopifyProduct({
|
||||||
ref: product.sku,
|
ref: product.sku,
|
||||||
handle: product.sku.toLowerCase().replace(/[^a-z0-9]+/g, '-'),
|
handle: product.sku.toLowerCase().replace(/[^a-z0-9]+/g, '-'),
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const COMMON_HEADERS = new Set([
|
|||||||
'Description courte', 'Description longue',
|
'Description courte', 'Description longue',
|
||||||
'Date de début de promo', 'Date de fin de promo',
|
'Date de début de promo', 'Date de fin de promo',
|
||||||
'État de la TVA', 'Classe de TVA', 'En stock ?',
|
'É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',
|
'Prix marché', 'Prix remisé', 'Code ecopart', 'Ecopart montant',
|
||||||
'Famille', 'Sous famille',
|
'Famille', 'Sous famille',
|
||||||
"Classe d'expédition (en retrait, livraison)",
|
"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'),
|
sku: findColIndex(headers, 'UGS'),
|
||||||
nom: findColIndex(headers, 'Nom'),
|
nom: findColIndex(headers, 'Nom'),
|
||||||
publie: findColIndex(headers, 'Publié'),
|
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é'),
|
stockConditionne: findColIndex(headers, 'Stock conditionné'),
|
||||||
prixMarche: findColIndex(headers, 'Prix marché'),
|
prixMarche: findColIndex(headers, 'Prix marché'),
|
||||||
prixRemise: findColIndex(headers, 'Prix remisé'),
|
prixRemise: findColIndex(headers, 'Prix remisé'),
|
||||||
|
|||||||
Reference in New Issue
Block a user