fix: recherche produit par SKU Shopify avec fallback sans suffixe (30827-dessus → 30827)

This commit is contained in:
2026-06-11 12:20:27 +02:00
parent 6a08fccb7a
commit 2de5c6670d
2 changed files with 48 additions and 21 deletions
+2 -3
View File
@@ -47,12 +47,11 @@ export async function GET(req: NextRequest) {
const ugs = (row[2] ?? '').trim()
// Le nom de fichier contient l'UGS (ex: "30827-dessus" contient "30827")
// Les UGS étant uniques, un simple contains suffit
const refLower = ref.toLowerCase()
const ugsLower = ugs.toLowerCase()
const isMatch = ugs && refLower.includes(ugsLower)
const isMatch = ugs && shopifyId && refLower.includes(ugsLower)
if (isMatch && shopifyId) {
if (isMatch) {
const title = (row[3] ?? '').trim() // col D = Nom
return NextResponse.json({ found: true, shopifyId, title })
}