From 6d67044cbd6ee70860b2882b968242806d0e5d87 Mon Sep 17 00:00:00 2001 From: Chirag Viradiya Date: Mon, 8 Jul 2019 16:05:57 +0530 Subject: [PATCH 1/3] Fixed error for the orderhistory null --- .../hooks/afterRegistration.ts | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/modules/google-tag-manager/hooks/afterRegistration.ts b/src/modules/google-tag-manager/hooks/afterRegistration.ts index b1c9eda6f4..a95dfb667f 100644 --- a/src/modules/google-tag-manager/hooks/afterRegistration.ts +++ b/src/modules/google-tag-manager/hooks/afterRegistration.ts @@ -70,23 +70,25 @@ export function afterRegistration (Vue, config, store, isServer) { { refresh: true, useCache: false } ).then(() => { const orderHistory = state.user.orders_history - const order = orderHistory.items.find((order) => order['entity_id'].toString() === orderId) - if (order) { - Vue.gtm.trackEvent({ - 'ecommerce': { - 'purchase': { - 'actionField': { - 'id': orderId, - 'affiliation': order.store_name, - 'revenue': order.total_due, - 'tax': order.tax_amount, - 'shipping': order.shipping_amount, - 'coupon': '' - }, - 'products': products + if (orderHistory) { + const order = orderHistory.items.find((order) => order['entity_id'].toString() === orderId) + if (order) { + Vue.gtm.trackEvent({ + 'ecommerce': { + 'purchase': { + 'actionField': { + 'id': orderId, + 'affiliation': order.store_name, + 'revenue': order.total_due, + 'tax': order.tax_amount, + 'shipping': order.shipping_amount, + 'coupon': '' + }, + 'products': products + } } - } - }) + }) + } } }) } From 6ea14854802092babe4e212d7e4449f8099c07da Mon Sep 17 00:00:00 2001 From: Chirag Viradiya Date: Tue, 9 Jul 2019 10:29:39 +0530 Subject: [PATCH 2/3] Update change log for google-tag-manager --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4c0d37b43..525d9b4a59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The SSR Cms console errors fixed + `magento-2-cms` module removed - @pkarw (#3155) - Cart unit tests throwing lots of type warnings - @lukeromanowicz (#3185) - Lack of possibility to mock src modules and theme components - @lukeromanowicz (#3185) +- Fixed error for the orderhistory null for google-tag-manager extension - @cnviradiya (#3195) ## [1.10.0-rc.1] - 2019.06.19 From ea6b60b347b2b9667ab87e2f307543a31f8153d8 Mon Sep 17 00:00:00 2001 From: Patryk Tomczyk <13100280+patzick@users.noreply.github.com> Date: Tue, 9 Jul 2019 11:55:29 +0200 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 525d9b4a59..18feb31f82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Resolve problem with getting CMS block from cache - @qiqqq (#2499) - Make image proxy url work with relative base url - @cewald (#3158) - Fixed memory leak with enabled dynamicConfigReload - @dimasch (#3075) +- Fixed error for the orderhistory null for google-tag-manager extension - @cnviradiya (#3195) ### Changed / Improved - Shipping address is saved as default when not logged in user chooses to create account during checkout - @iwonapiotrowska (#2636) @@ -31,7 +32,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The SSR Cms console errors fixed + `magento-2-cms` module removed - @pkarw (#3155) - Cart unit tests throwing lots of type warnings - @lukeromanowicz (#3185) - Lack of possibility to mock src modules and theme components - @lukeromanowicz (#3185) -- Fixed error for the orderhistory null for google-tag-manager extension - @cnviradiya (#3195) ## [1.10.0-rc.1] - 2019.06.19