Aligned variable names
parent
48b4963dfe
commit
029f279331
|
@ -115,7 +115,7 @@ const updateTotalCart = (req, res) => {
|
|||
const config = getConfig();
|
||||
|
||||
req.session.totalCartAmount = 0;
|
||||
req.session.cartTotalItems = 0;
|
||||
req.session.totalCartItems = 0;
|
||||
|
||||
// If cart is empty return zero values
|
||||
if(!req.session.cart){
|
||||
|
@ -127,7 +127,7 @@ const updateTotalCart = (req, res) => {
|
|||
});
|
||||
|
||||
// Update the total items in cart for the badge
|
||||
req.session.cartTotalItems = Object.keys(req.session.cart).length;
|
||||
req.session.totalCartItems = Object.keys(req.session.cart).length;
|
||||
|
||||
// under the free shipping threshold
|
||||
if(req.session.totalCartAmount < config.freeShippingAmount){
|
||||
|
|
|
@ -512,7 +512,7 @@ router.post('/product/addtocart', async (req, res, next) => {
|
|||
req.session.cartSubscription = product.productSubscription;
|
||||
}
|
||||
|
||||
return res.status(200).json({ message: 'Cart successfully updated', totalCartItems: req.session.cartTotalItems });
|
||||
return res.status(200).json({ message: 'Cart successfully updated', totalCartItems: req.session.totalCartItems });
|
||||
});
|
||||
|
||||
// search products
|
||||
|
|
Loading…
Reference in New Issue