diff --git a/src/stores/sierrasprings.js b/src/stores/sierrasprings.js index 8e4ac1d..8a3edf5 100644 --- a/src/stores/sierrasprings.js +++ b/src/stores/sierrasprings.js @@ -56,8 +56,12 @@ function parseWooStoreProductsJson(payload, ctx) { const price = formatWooStorePrice(p.prices); - const id = (p && (p.id ?? p.id === 0)) ? String(p.id) : ""; - const taggedSku = id ? `id:${id}` : ""; + const rawSku = + (typeof p?.sku === "string" && p.sku.trim()) ? p.sku.trim() + : (p && (p.id ?? p.id === 0)) ? String(p.id) + : ""; + + const taggedSku = /^\d{1,11}$/.test(rawSku) ? `id:${rawSku}` : rawSku; const sku = normalizeSkuKey(taggedSku, { storeLabel: ctx?.store?.name, url }); const img = @@ -344,8 +348,6 @@ async function scanCategoryWooStoreApi(ctx, prevDb, report) { ); } - - function createStore(defaultUa) { const ua = defaultUa;