summaryrefslogtreecommitdiff
path: root/src/helpers/cart.js
diff options
context:
space:
mode:
authorRafi Zadanly <rafizadanly@gmail.com>2022-12-26 17:07:40 +0700
committerRafi Zadanly <rafizadanly@gmail.com>2022-12-26 17:07:40 +0700
commit1e12cbcedbb8eaf52982cef89e35a29b0e555537 (patch)
tree8409ab9f0606491ac7d3b8d4d5bbc8a40fccd90f /src/helpers/cart.js
parentf2dad674f9096ca2423cbbdc0228576f094f064c (diff)
save state cart to process
Diffstat (limited to 'src/helpers/cart.js')
-rw-r--r--src/helpers/cart.js9
1 files changed, 2 insertions, 7 deletions
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;
}