Skip to content

Commit db6a696

Browse files
committed
fix: properly setting variation price and test variation gtin on product import
1 parent 48351bf commit db6a696

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

functions/lib/integration/parsers/product-to-ecomplus.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ module.exports = async (tinyProduct, storeId, auth, isNew = true, tipo, appData)
225225
}
226226
}
227227
if (specTexts.length) {
228-
const variationPlus = {
228+
const variation = {
229229
_id: ecomUtils.randomObjectId(),
230230
name: `${name} / ${specTexts.join(' / ')}`.substring(0, 100),
231231
sku: codigo,
@@ -234,9 +234,13 @@ module.exports = async (tinyProduct, storeId, auth, isNew = true, tipo, appData)
234234
picture_id: pictureId
235235
}
236236
if (price !== parseFloat(preco)) {
237-
variacaoObj.price = parseFloat(preco)
237+
variation.price = parseFloat(preco)
238238
}
239-
product.variations.push(variationPlus)
239+
const gtin = variacao.gtin || variacao.gtin_embalagem || variacao.gtinEmbalagem
240+
if (validateGtin(gtin)) {
241+
variacao.gtin = gtin
242+
}
243+
product.variations.push(variation)
240244
}
241245
}
242246
})

0 commit comments

Comments
 (0)