From fbd0e8eb8aa89d5e636cce3411e98bb5fffa0313 Mon Sep 17 00:00:00 2001 From: Yair Dovrat Date: Mon, 29 Jan 2024 18:15:09 +0100 Subject: [PATCH] fix pinterest ecommerce --- src/index.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index b5410ee..e56a75c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -66,10 +66,10 @@ function mapEcommerceData( ecommerce: EcommerceType ): Record | null { const transformedProductData: Record = {} - if (!ecommerce || !ecommerce.products) { + if (!ecommerce) { return null } else { - ecommerce.products.forEach((product, index) => + ecommerce.products?.forEach((product, index) => [ 'product_id', 'sku', @@ -121,7 +121,6 @@ export const getRequestBody = ( } const { pdem, tid, ecommerce, ...cleanPayload } = payload - // pd - partner data if (pdem) { requestBody['pd[em]'] = pdem @@ -186,7 +185,6 @@ export default async function (manager: Manager, settings: ComponentSettings) { handler(event, settings, ev) }) }) - manager.addEventListener('ecommerce', event => { if (typeof event.name === 'string') { const ev = mapEcommerceEvent(event.name)