Skip to content

Commit 7d5631d

Browse files
committed
feat: additional admin settings option to skip NCM/MPN sync [#165]
fixes #165
1 parent c984739 commit 7d5631d

4 files changed

Lines changed: 12 additions & 3 deletions

File tree

functions/ecom.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,15 @@ const app = {
236236
},
237237
hide: true
238238
},
239+
disable_ncm: {
240+
schema: {
241+
type: 'boolean',
242+
default: false,
243+
title: 'Desabilitar sincronização de NCMs',
244+
description: 'Desabilitar importação/exportação de NCM/MPN de produtos'
245+
},
246+
hide: true
247+
},
239248
non_number: {
240249
schema: {
241250
type: 'boolean',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ module.exports = async (tinyProduct, storeId, auth, isNew = true, tipo, appData)
136136
product.min_quantity = minQuantity
137137
}
138138
}
139-
if (tinyProduct.ncm) {
139+
if (tinyProduct.ncm && !appData.disable_ncm) {
140140
product.mpn = [tinyProduct.ncm]
141141
}
142142
const validateGtin = gtin => typeof gtin === 'string' && /^([0-9]{8}|[0-9]{12,14})$/.test(gtin)

functions/lib/integration/parsers/product-to-tiny-variation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module.exports = (ecomProduct, variation, originalTinyProduct, appData, storeId)
4646
tinyProduct.garantia = product.warranty.substring(0, 20)
4747
}
4848

49-
if (product.mpn && product.mpn.length) {
49+
if (product.mpn && product.mpn.length && !appData.disable_ncm) {
5050
tinyProduct.ncm = product.mpn[0]
5151
}
5252
if (product.gtin && product.gtin.length) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ module.exports = (product, originalTinyProduct, appData, storeId) => {
4040
tinyProduct.garantia = product.warranty.substring(0, 20)
4141
}
4242

43-
if (product.mpn && product.mpn.length) {
43+
if (product.mpn && product.mpn.length && !appData.disable_ncm) {
4444
tinyProduct.ncm = product.mpn[0]
4545
}
4646
if (product.gtin && product.gtin.length) {

0 commit comments

Comments
 (0)