From f2985bc7915289710f22a127b272bdb657cfc417 Mon Sep 17 00:00:00 2001 From: Vitalij Mik Date: Thu, 2 May 2024 11:24:04 +0200 Subject: [PATCH] NTR: fix offcanvas errors (#740) Co-authored-by: Vitalij Mik --- .../src/mollie-payments/plugins/apple-pay-direct.plugin.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Resources/app/storefront/src/mollie-payments/plugins/apple-pay-direct.plugin.js b/src/Resources/app/storefront/src/mollie-payments/plugins/apple-pay-direct.plugin.js index ab95242ec..b4853b5cf 100644 --- a/src/Resources/app/storefront/src/mollie-payments/plugins/apple-pay-direct.plugin.js +++ b/src/Resources/app/storefront/src/mollie-payments/plugins/apple-pay-direct.plugin.js @@ -22,7 +22,12 @@ export default class MollieApplePayDirect extends Plugin { // we need to re-init all apple pay button // once the offcanvas is loaded (lazy) into the DOM - const pluginOffCanvas = window.PluginManager.getPluginList().OffCanvasCart.get("instances")[0]; + const pluginOffCanvasInstances = window.PluginManager.getPluginList().OffCanvasCart.get("instances"); + if(pluginOffCanvasInstances.length === 0){ + return; + } + + const pluginOffCanvas = pluginOffCanvasInstances[0]; pluginOffCanvas.$emitter.subscribe('offCanvasOpened', me.onOffCanvasOpened.bind(me)); // now update our current page