From 570271df28aba71b2745b048fc13205537bea758 Mon Sep 17 00:00:00 2001 From: w3bdesign <45217974+w3bdesign@users.noreply.github.com> Date: Wed, 23 Oct 2024 06:20:37 +0200 Subject: [PATCH] Update AddToCart.component.tsx --- src/components/Product/AddToCart.component.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/components/Product/AddToCart.component.tsx b/src/components/Product/AddToCart.component.tsx index b5f1dde18..d6db20183 100644 --- a/src/components/Product/AddToCart.component.tsx +++ b/src/components/Product/AddToCart.component.tsx @@ -96,7 +96,7 @@ const AddToCart = ({ variationId, fullWidth = false, }: IProductRootObject) => { - const { setCart, cart } = useContext(CartContext); + const { setCart, isLoading: isCartLoading } = useContext(CartContext); const [requestError, setRequestError] = useState(false); const productId = product?.databaseId ? product?.databaseId : variationId; @@ -141,10 +141,6 @@ const AddToCart = ({ }); const handleAddToCart = () => { - if (!cart) { - console.log('Cart is not yet initialized. Please wait.'); - return; - } addToCart(); // Refetch cart after 2 seconds setTimeout(() => { @@ -156,10 +152,10 @@ const AddToCart = ({ <> );