diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2025-01-23 09:28:23 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2025-01-23 09:28:23 +0700 |
| commit | 2ce7d2605e3c20963589a19abd5ae3e9f6aae6fe (patch) | |
| tree | 0059dfc638f07baed1a1f05ec39ab3bd92b059eb /src/lib/product | |
| parent | 6d9c1067b6e857eb95f12864cc88117350ae6cfb (diff) | |
<iman> set selected varian ke yang is_in_bu = true
Diffstat (limited to 'src/lib/product')
| -rw-r--r-- | src/lib/product/components/Product/ProductMobile.jsx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx index 4cfd3755..16182271 100644 --- a/src/lib/product/components/Product/ProductMobile.jsx +++ b/src/lib/product/components/Product/ProductMobile.jsx @@ -95,7 +95,11 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { useEffect(() => { if (!selectedVariant && variantOptions.length == 1) { - setSelectedVariant(variantOptions[0]); + const selectedVariant = + variantOptions?.find((variant) => variant.is_in_bu) || + variantOptions?.[0]; + setSelectedVariant(selectedVariant); + // setSelectedVariant(variantOptions[0]); } }, [selectedVariant, variantOptions]); |
