Fixed not adding shipping amount to total cart amount

master
Mark Moffat 2020-01-04 17:56:43 +10:30
parent c73d67b923
commit ef73dd6c71
1 changed files with 5 additions and 0 deletions

View File

@ -9,12 +9,14 @@ const calculateShipping = (amount, config, req) => {
// Update message and amount
req.session.shippingMessage = 'Instore pickup';
req.session.totalCartShipping = 0;
req.session.totalCartAmount = req.session.totalCartAmount + 0;
return;
}
if(amount >= freeThreshold){
req.session.shippingMessage = 'FREE shipping';
req.session.totalCartShipping = 0;
req.session.totalCartAmount = req.session.totalCartAmount + 0;
return;
}
@ -22,6 +24,7 @@ const calculateShipping = (amount, config, req) => {
if(!req.session.customerCountry){
req.session.shippingMessage = 'Estimated shipping';
req.session.totalCartShipping = domesticShippingAmount;
req.session.totalCartAmount = req.session.totalCartAmount + domesticShippingAmount;
return;
}
@ -29,12 +32,14 @@ const calculateShipping = (amount, config, req) => {
if(req.session.customerCountry.toLowerCase() !== shippingFromCountry.toLowerCase()){
req.session.shippingMessage = 'International shipping';
req.session.totalCartShipping = internationalShippingAmount;
req.session.totalCartAmount = req.session.totalCartAmount + internationalShippingAmount;
return;
}
// Domestic shipping
req.session.shippingMessage = 'Domestic shipping';
req.session.totalCartShipping = domesticShippingAmount;
req.session.totalCartAmount = req.session.totalCartAmount + domesticShippingAmount;
};
module.exports = {