Skip to content

Commit

Permalink
fix(rates.ts): remove unnecessary comments and add support for free s…
Browse files Browse the repository at this point in the history
…hipping

feat(rates.ts): add support for free shipping option in rates calculation
  • Loading branch information
jamalsoueidan committed Dec 12, 2023
1 parent e93ffb2 commit ac42346
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/functions/shipping/services/rates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,28 @@ export const ShippingServiceRates = async (body: ShippingBody) => {

const totalPrices = prices.reduce((total, price) => total + price, 0);

if (hasFreeShipping) {
return {
rates: [
{
service_name: `Demo (udgifter ${totalPrices * 100})`,
service_code: "ETON",
total_price: 0,
currency: "DKK",
phone_required: true,
},
],
};
}

return {
rates: [
{
service_name: `Udgifter i forbindelse med kørsel`,
//description: "Inkludere alle udgifter",
service_code: "ETON",
total_price: hasFreeShipping ? 0 : totalPrices * 100,
total_price: totalPrices * 100,
currency: "DKK",
phone_required: true,
//min_delivery_date: onMinDate,
//max_delivery_date: onMaxDate,
},
],
};
Expand Down

0 comments on commit ac42346

Please sign in to comment.