From c6abd9ee519de72c7b138f8665b451f6f39305c2 Mon Sep 17 00:00:00 2001 From: Matheus Reis <35343551+matheusgnreis@users.noreply.github.com> Date: Sat, 6 Jul 2024 00:43:21 -0300 Subject: [PATCH] chore: check if has dimension or weight value and set another one --- functions/routes/ecom/modules/calculate-shipping.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/routes/ecom/modules/calculate-shipping.js b/functions/routes/ecom/modules/calculate-shipping.js index c78ceaa..1b387ca 100644 --- a/functions/routes/ecom/modules/calculate-shipping.js +++ b/functions/routes/ecom/modules/calculate-shipping.js @@ -183,10 +183,10 @@ exports.post = async ({ appSdk }, req, res) => { correiosParams: { cepOrigem, cepDestino, - psObjeto: pkg.weight.value || 500, - comprimento: pkg.dimensions.length.value || 16, - altura: pkg.dimensions.height.value || 2, - largura: pkg.dimensions.width.value || 11, + psObjeto: (pkg.weight.value > 0 ? pkg.weight.value : 500), + comprimento: (pkg.dimensions.length.value > 0 ? pkg.dimensions.length.value : 16), + altura: (pkg.dimensions.length.value > 0 ? pkg.dimensions.length.value : 2), + largura: (pkg.dimensions.length.value > 0 ? pkg.dimensions.length.value : 11), vlDeclarado, servicosAdicionais },