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-migrate/modules | |
| parent | 6d9c1067b6e857eb95f12864cc88117350ae6cfb (diff) | |
<iman> set selected varian ke yang is_in_bu = true
Diffstat (limited to 'src-migrate/modules')
| -rw-r--r-- | src-migrate/modules/product-detail/components/ProductDetail.tsx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx index b036cc2d..f23aa9dc 100644 --- a/src-migrate/modules/product-detail/components/ProductDetail.tsx +++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx @@ -66,7 +66,11 @@ const ProductDetail = ({ product }: Props) => { if (typeof auth === 'object') { setIsApproval(auth?.feature?.soApproval); } - setSelectedVariant(product?.variants[0]) + const selectedVariant = + product?.variants?.find((variant) => variant.is_in_bu) || + product?.variants?.[0]; + setSelectedVariant(selectedVariant); + // setSelectedVariant(product?.variants[0]) }, []); return ( |
