diff --git a/src/Resources/views/storefront/base.html.twig b/src/Resources/views/storefront/base.html.twig index 073e5f54b..066fee9b4 100644 --- a/src/Resources/views/storefront/base.html.twig +++ b/src/Resources/views/storefront/base.html.twig @@ -1,10 +1,38 @@ {% sw_extends '@Storefront/storefront/base.html.twig' %} {% block base_main %} + + {% block mollie_payments_js_control %} + {% set onlyShowHere = { + 'frontend.checkout.confirm.page' : '', + 'frontend.checkout.cart.page' : 'cart', + 'frontend.navigation.page' : 'plp', + 'frontend.account.edit-order.page' : '', + 'frontend.detail.page' : 'pdp' + } %} + + + {% set currentRoute = app.request.attributes.get('_route') %} + {% set implementJS = false %} + + {# js always required on this pages #} + {% if currentRoute == 'frontend.checkout.cart.page' or currentRoute == 'frontend.checkout.confirm.page' %} + {% set implementJS = true %} + {% endif %} + {% if mollie_applepaydirect_enabled %} + {% if currentRoute in onlyShowHere|keys and onlyShowHere[currentRoute] not in mollie_applepaydirect_restrictions %} + {% set implementJS = true %} + {% endif %} + {% if 'offcanvas' not in mollie_applepaydirect_restrictions %} + {% set implementJS = true %} + {% endif %} + {% endif %} + {% endblock %} + - {% if mollie_javascript_use_shopware != '1' %} + {% if mollie_javascript_use_shopware != '1' and implementJS %} {% endif %} {{ parent() }}