diff options
| author | FIN-IT_AndriFP <andrifebriyadiputra@gmail.com> | 2026-01-05 10:41:39 +0700 |
|---|---|---|
| committer | FIN-IT_AndriFP <andrifebriyadiputra@gmail.com> | 2026-01-05 10:41:39 +0700 |
| commit | fd50180ac301916c6feb5e93598f3fc59ecb78a8 (patch) | |
| tree | 3deec1aaa8952d43882e262d9ed3d35377ec7967 /src | |
| parent | ddc308aa4e5da482763f97e16ab92fe777e8dfeb (diff) | |
(andri) get desc variant product from magento
Diffstat (limited to 'src')
| -rw-r--r-- | src/pages/api/magento-product.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/pages/api/magento-product.ts b/src/pages/api/magento-product.ts index 297f0ebc..ef5fd3bc 100644 --- a/src/pages/api/magento-product.ts +++ b/src/pages/api/magento-product.ts @@ -103,6 +103,15 @@ 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 : ''; + }); + + + // ===================================================================== // 3. AMBIL LINKS (UPSELL & RELATED) DARI MAIN VARIANT SAJA // ===================================================================== @@ -126,7 +135,8 @@ export default async function handler( res.status(200).json({ specsMatrix: matrix, upsell_ids: upsellIds, - related_ids: relatedIds + related_ids: relatedIds, + descriptions: descriptions }); } catch (error) { |
