summaryrefslogtreecommitdiff
path: root/src/pages/api/magento-product.ts
diff options
context:
space:
mode:
authorFIN-IT_AndriFP <andrifebriyadiputra@gmail.com>2026-01-09 14:35:06 +0700
committerFIN-IT_AndriFP <andrifebriyadiputra@gmail.com>2026-01-09 14:35:06 +0700
commit13a6ccd99722464342942eeb7fbc73c2f0f27542 (patch)
tree4b4340021a0e6d936cb35fe4511a81b07ad4f076 /src/pages/api/magento-product.ts
parent983aae0a27ed93009964edf2cdf2c4d0f1ea072e (diff)
parent6c2de1aa1cc655b1da525015ac0280fd4c72731f (diff)
fix merge
Diffstat (limited to 'src/pages/api/magento-product.ts')
-rw-r--r--src/pages/api/magento-product.ts19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/pages/api/magento-product.ts b/src/pages/api/magento-product.ts
index 297f0ebc..4e963844 100644
--- a/src/pages/api/magento-product.ts
+++ b/src/pages/api/magento-product.ts
@@ -103,6 +103,21 @@ export default async function handler(
matrix.push(row);
});
+ // Deskripsi produk per varian
+ const descriptions:Record<string, string> = {};
+ items.forEach((p: any) => {
+ 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 : '';
+ });
+
+
+
// =====================================================================
// 3. AMBIL LINKS (UPSELL & RELATED) DARI MAIN VARIANT SAJA
// =====================================================================
@@ -126,7 +141,9 @@ export default async function handler(
res.status(200).json({
specsMatrix: matrix,
upsell_ids: upsellIds,
- related_ids: relatedIds
+ related_ids: relatedIds,
+ descriptions: descriptions,
+ warranties: warranties,
});
} catch (error) {