From 1e12cbcedbb8eaf52982cef89e35a29b0e555537 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 26 Dec 2022 17:07:40 +0700 Subject: save state cart to process --- src/helpers/cart.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/helpers/cart.js') diff --git a/src/helpers/cart.js b/src/helpers/cart.js index 8712c03a..2cd8da7b 100644 --- a/src/helpers/cart.js +++ b/src/helpers/cart.js @@ -14,14 +14,9 @@ const getItemCart = (product_id) => { return cart[product_id]; } -const createOrUpdateItemCart = (product_id, quantity) => { +const createOrUpdateItemCart = (product_id, quantity, to_process = false) => { let cart = getCart(); - let isFoundInCart = cart[product_id]; - if (isFoundInCart) { - cart[product_id].quantity = quantity; - } else { - cart[product_id] = { product_id, quantity }; - } + cart[product_id] = { product_id, quantity, to_process }; setCart(cart); return true; } -- cgit v1.2.3