summaryrefslogtreecommitdiff
path: root/src/lib/product
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-10-30 09:21:30 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-10-30 09:21:30 +0700
commite8c414325a1e32474e740cc6e7dca8396affc5e3 (patch)
treee84feb31cd8619d208b4558c5fcf30becc5337e0 /src/lib/product
parent1694c12f75ad06c5e40d6f9a66e245c3e683146c (diff)
parentc82110f7d3a2f85de99045fde7b579e369f15b2c (diff)
Merge branch 'refactor/all' into development
Diffstat (limited to 'src/lib/product')
-rw-r--r--src/lib/product/components/Product/ProductDesktop.jsx16
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 () => {