Skip to content

Commit 3b42b02

Browse files
committed
fix: prevent error on order export with shipping line undefined app
1 parent 53bf7dc commit 3b42b02

File tree

1 file changed

+7
-3
lines changed
  • functions/lib/integration/parsers/order-to-bling

1 file changed

+7
-3
lines changed

functions/lib/integration/parsers/order-to-bling/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,13 @@ module.exports = (order, blingOrderNumber, blingStore, appData, customerIdBling,
9090
)
9191
}
9292
if (!originalBlingOrder || !originalBlingOrder.transporte?.volumes?.length) {
93-
blingOrder.transporte.volumes = [{
94-
servico: shippingService ? shippingService.bling_shipping : shippingLine.app.service_code
95-
}]
93+
let shippingLabel = shippingService?.bling_shipping
94+
if (!shippingLabel) {
95+
shippingLabel = shippingLine.app?.service_code || order.shipping_method_label
96+
}
97+
if (shippingLabel) {
98+
blingOrder.transporte.volumes = [{ servico: shippingLabel }]
99+
}
96100
}
97101

98102
if (shippingLine.package && shippingLine.package.weight) {

0 commit comments

Comments
 (0)