summaryrefslogtreecommitdiff
path: root/src/lib/product
diff options
context:
space:
mode:
authorHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-10-23 11:34:23 +0700
committerHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-10-23 11:34:23 +0700
commit6cdf1f1fc109d6eb31ac9b57940a507104d12f05 (patch)
tree4d038d763fb48e69956c12644e316604ba9f4a6d /src/lib/product
parent4310c68248520d265879fbc0a2fc094f7f3e3b52 (diff)
parentbf33b9a9493aeab84e72647fad384bed43feabd5 (diff)
Merge branch 'master' into CR/UI
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 () => {