Skip to content

Commit f55eb6e

Browse files
committed
chore: debug incomplete/unexpected response from stocks url
1 parent 9e57ccd commit f55eb6e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

functions/lib/integration/imports/products-to-ecom.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ module.exports = async ({ appSdk, storeId, auth }, productHorus, opts) => {
9494
const isUpdateStock = updateStock && (SALDO_DISPONIVEL >= 0 || SALDO >= 0)
9595

9696
const inventory = {}
97+
const { stocks_url: stocksUrl, stocks_token: stocksToken } = opts.appData
9798
if (quantity !== product?.quantity && isUpdateStock) {
98-
const { stocks_url: stocksUrl, stocks_token: stocksToken } = opts.appData
9999
if (stocksUrl && stocksToken) {
100100
const url = `${stocksUrl}?cod_item=${COD_ITEM}`
101101
logger.info(`Fetching full stock for ${COD_ITEM}`, { url })
@@ -137,9 +137,11 @@ module.exports = async ({ appSdk, storeId, auth }, productHorus, opts) => {
137137
}
138138

139139
logger.info(`COD_ITEM ${COD_ITEM}`, {
140+
stocksUrl,
140141
productHorus,
141142
isUpdatePriceOrStock,
142143
isUpdateStock,
144+
currentProductQuantity: product?.quantity,
143145
quantity,
144146
inventory
145147
})

0 commit comments

Comments
 (0)