Skip to content

Commit

Permalink
Fix Object.reduce is not a method
Browse files Browse the repository at this point in the history
Issue: #5
  • Loading branch information
mithredate committed Apr 5, 2024
1 parent 37924ef commit 52d8147
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion template.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions template.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -936,5 +936,3 @@ scenarios: []
___NOTES___

Created on 18/08/2022, 12:25:26


0 comments on commit 52d8147

Please sign in to comment.