Skip to content

Commit

Permalink
chore(calculate-shipping): use appData instead config
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusgnreis authored Jan 26, 2024
1 parent bdc1c85 commit a07bbcf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions functions/routes/ecom/modules/calculate-shipping.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,19 +283,19 @@ exports.post = async ({ appSdk }, req, res) => {
}

// check for default configured additional/discount price
if (typeof config.additional_price === 'number' && config.additional_price) {
if (config.additional_price > 0) {
if (typeof appData.additional_price === 'number' && appData.additional_price) {
if (appData.additional_price > 0) {
shippingLine.other_additionals = [{
tag: 'additional_price',
label: 'Adicional padrão',
price: config.additional_price
price: appData.additional_price
}]
} else {
// negative additional price to apply discount
shippingLine.discount -= config.additional_price
shippingLine.discount -= appData.additional_price
}
// update total price
shippingLine.total_price += config.additional_price
shippingLine.total_price += appData.additional_price
}

// search for discount by shipping rule
Expand Down

0 comments on commit a07bbcf

Please sign in to comment.