summaryrefslogtreecommitdiff
path: root/src/lib/cart/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/cart/components')
-rw-r--r--src/lib/cart/components/Cart.jsx6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx
index d0685fe3..b0de5168 100644
--- a/src/lib/cart/components/Cart.jsx
+++ b/src/lib/cart/components/Cart.jsx
@@ -72,7 +72,7 @@ const Cart = () => {
}, [products])
useEffect(() => {
- const LoadProductSImilar = async () => {
+ const LoadProductSimilar = async () => {
const randProductIndex = Math.floor(Math.random() * products.length)
const productLoad = await productSearchApi({
query: `q=${products?.[randProductIndex].parent.name}&limit=10`
@@ -80,8 +80,8 @@ const Cart = () => {
setProductRecomendation(productLoad)
}
- if (products?.length > 0) LoadProductSImilar()
- }, [products])
+ if (products?.length > 0 && !productRecomendation) LoadProductSimilar()
+ }, [products, productRecomendation])
const updateQuantity = (value, productId, operation = '') => {
let productIndex = products.findIndex((product) => product.id == productId)