diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/product/components/Product/ProductDesktop.jsx | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index 11c34009..a8cca416 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -45,21 +45,9 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => { const { setRefreshCart, refreshCart } = useProductCartContext() - const getLowestPrice = useCallback(() => { - const prices = product.variants.map((variant) => ({ - price: variant.price, - isFlashsale: variant.isFlashsale - })) - const lowest = prices.reduce((lowest, price) => { - return price.price < lowest.price ? price : lowest - }, prices[0]) - return lowest - }, [product]) - useEffect(() => { - const lowest = getLowestPrice() - setLowestPrice(lowest) - }, [getLowestPrice]) + setLowestPrice({ price: product?.lowestPrice }) + }, [product]) useEffect(() => { const getBackgound = async () => { |
