From 52d81477ab28d21ca5b2a73b7990501104ce8f68 Mon Sep 17 00:00:00 2001 From: Mehrdad Date: Fri, 5 Apr 2024 18:42:35 +0330 Subject: [PATCH] Fix Object.reduce is not a method Issue: https://github.com/stape-io/linkedin-tag/issues/5 --- template.js | 2 +- template.tpl | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/template.js b/template.js index 2a5b5fb..cfae262 100644 --- a/template.js +++ b/template.js @@ -142,7 +142,7 @@ function getConversionValue() { const hasItems = getType(eventData.items) === 'array' && !!eventData.items[0]; const itemsCurrency = hasItems ? eventData.items[0].currency : 'NA?'; const itemsValue = hasItems - ? eventData.items[0].reduce((acc, item) => { + ? eventData.items.reduce((acc, item) => { const price = item.price || 0; const quantity = item.quantity || 1; return acc + price * quantity; diff --git a/template.tpl b/template.tpl index 2078317..97207f1 100644 --- a/template.tpl +++ b/template.tpl @@ -445,7 +445,7 @@ function getConversionValue() { const hasItems = getType(eventData.items) === 'array' && !!eventData.items[0]; const itemsCurrency = hasItems ? eventData.items[0].currency : 'NA?'; const itemsValue = hasItems - ? eventData.items[0].reduce((acc, item) => { + ? eventData.items.reduce((acc, item) => { const price = item.price || 0; const quantity = item.quantity || 1; return acc + price * quantity; @@ -936,5 +936,3 @@ scenarios: [] ___NOTES___ Created on 18/08/2022, 12:25:26 - -