@@ -99,7 +99,7 @@ export const getUpdatedProducts = (
99
99
) ;
100
100
101
101
// If product exists ( index of that product was found in the array ), update the product quantity and totalPrice
102
- if ( - 1 < productExitsIndex ) {
102
+ if ( - 1 < productExistsIndex ) {
103
103
let updatedProducts = existingProductsInCart ;
104
104
let updatedProduct = updatedProducts [ productExistsIndex ] ;
105
105
@@ -158,17 +158,17 @@ export const removeItemFromCart = (productId) => {
158
158
}
159
159
160
160
// Check if the product already exits in the cart.
161
- const productExitsIndex = isProductInCart ( existingCart . products , productId ) ;
161
+ const productExistsIndex = isProductInCart ( existingCart . products , productId ) ;
162
162
163
163
// If product to be removed exits
164
- if ( - 1 < productExitsIndex ) {
165
- const productTobeRemoved = existingCart . products [ productExitsIndex ] ;
164
+ if ( - 1 < productExistsIndex ) {
165
+ const productTobeRemoved = existingCart . products [ productExistsIndex ] ;
166
166
const qtyToBeRemovedFromTotal = productTobeRemoved . qty ;
167
167
const priceToBeDeductedFromTotal = productTobeRemoved . totalPrice ;
168
168
169
169
// Remove that product from the array and update the total price and total quantity of the cart
170
170
let updatedCart = existingCart ;
171
- updatedCart . products . splice ( productExitsIndex , 1 ) ;
171
+ updatedCart . products . splice ( productExistsIndex , 1 ) ;
172
172
updatedCart . totalProductsCount =
173
173
updatedCart . totalProductsCount - qtyToBeRemovedFromTotal ;
174
174
updatedCart . totalProductsPrice =
0 commit comments