{% block mollie_head_scripts %} {# pages where apple pay requires js with their mollie_applepaydirect_restrictions names as values #} {% set onlyShowHere = { 'frontend.checkout.confirm.page' : '', 'frontend.checkout.cart.page' : 'cart', 'frontend.navigation.page' : 'plp', 'frontend.account.edit-order.page' : '', 'frontend.detail.page' : 'pdp', 'frontend.checkout.register.page' : 'register' } %} {% set currentRoute = app.request.attributes.get('_route') %} {% set includeJsInHeader = false %} {# js always required on this pages #} {% if currentRoute == 'frontend.checkout.cart.page' or currentRoute == 'frontend.checkout.confirm.page' or currentRoute == 'frontend.account.edit-order.page' %} {% set includeJsInHeader = true %} {% endif %} {% if mollie_paypalexpress_restrictions is null %} {% set mollie_paypalexpress_restrictions = [] %} {% endif %} {% if mollie_applepaydirect_restrictions is null %} {% set mollie_applepaydirect_restrictions = [] %} {% endif %} {% set restrictions = mollie_applepaydirect_restrictions | merge(mollie_paypalexpress_restrictions) %} {# requirement check for apple pay direct #} {% if mollie_applepaydirect_enabled == true or mollie_applepay_enabled == true or mollie_paypalexpress_enabled == true %} {% if currentRoute in onlyShowHere|keys and onlyShowHere[currentRoute] not in restrictions %} {% set includeJsInHeader = true %} {% endif %} {% if 'offcanvas' not in mollie_applepaydirect_restrictions or 'offcanvas' not in mollie_paypalexpress_restrictions %} {% set includeJsInHeader = true %} {% endif %} {% endif %} {% if mollie_javascript_already_exists == false and mollie_javascript_use_shopware != '1' and includeJsInHeader == true %} {% endif %} {% endblock %}