Fixed not adding shipping amount to total cart amount
parent
c73d67b923
commit
ef73dd6c71
|
@ -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 = {
|
||||
|
|
Loading…
Reference in New Issue