diff options
| -rw-r--r-- | src-migrate/modules/product-detail/components/Information.tsx | 9 | ||||
| -rw-r--r-- | src/pages/api/magento-product.ts | 9 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src-migrate/modules/product-detail/components/Information.tsx b/src-migrate/modules/product-detail/components/Information.tsx index b7d3401e..4d54c03c 100644 --- a/src-migrate/modules/product-detail/components/Information.tsx +++ b/src-migrate/modules/product-detail/components/Information.tsx @@ -273,7 +273,7 @@ const Information = ({ product }: Props) => { </Box> </Flex> - {/* 3. Garansi Produk */} + {/* 3. Garansi Produk - UPDATED DYNAMIC VALUE */} <Flex align="center" className="gap-3"> <img src="/images/garansi.svg" @@ -282,7 +282,12 @@ const Information = ({ product }: Props) => { /> <Box> <Text fontSize="11px" color="gray.500" lineHeight="short" mb="1px">Garansi Produk</Text> - <Text fontSize="12px" fontWeight="bold" color="gray.800" lineHeight="short">24 Bulan</Text> + <Text fontSize="12px" fontWeight="bold" color="gray.800" lineHeight="short"> + {/* Mengambil dari selectedVariant.z_warranty */} + {selectedVariant && (selectedVariant as any).z_warranty + ? (selectedVariant as any).z_warranty + : '-'} + </Text> </Box> </Flex> </SimpleGrid> diff --git a/src/pages/api/magento-product.ts b/src/pages/api/magento-product.ts index ef5fd3bc..4e963844 100644 --- a/src/pages/api/magento-product.ts +++ b/src/pages/api/magento-product.ts @@ -109,6 +109,12 @@ export default async function handler( const descAttr = p.custom_attributes.find((a: any) => a.attribute_code === 'description' || a.attribute_code === 'short_description'); descriptions[p.sku] = descAttr ? descAttr.value : ''; }); + + const warranties: Record<string, string> = {}; + items.forEach((p: any) => { + const warAttr = p.custom_attributes.find((a: any) => a.attribute_code === 'z_warranty'); + warranties[p.sku] = warAttr ? warAttr.value : ''; + }); @@ -136,7 +142,8 @@ export default async function handler( specsMatrix: matrix, upsell_ids: upsellIds, related_ids: relatedIds, - descriptions: descriptions + descriptions: descriptions, + warranties: warranties, }); } catch (error) { |
