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