Extending Plugin Template in a Child Theme

43 views Asked by At

I have created a child theme to make some modifications to the existing design. Along with other changes, I am trying to extend the "amazon-pay-button.html.twig" template from the SwagAmazonPay plugin, but it does not work.

The path to the template I want to extend is:

Resources/views/storefront/component/swag-amazon-pay/amazon-pay-button.html.twig

And here is the code I am using to extend the template:

{% sw_extends '@Storefront/storefront/component/swag-amazon-pay/amazon-pay-button.html.twig' %}

{% block storefront_component_swag_amazon_pay_amazon_pay_button %}
    {% if identifier != 'offcanvas-cart' %}
        {{ parent() }}
    {% endif %}
{% endblock %}

In addition to the issue mentioned above, I am also extending another part of the parent theme. Specifically, I am extending the component_offcanvas_cart_actions block in the @THEMENAME/storefront/component/checkout/offcanvas-cart.html.twig template.

I noticed that the SwagAmazonPay plugin also extends this block in a similar fashion:

{% sw_extends '@Storefront/storefront/component/checkout/offcanvas-cart.html.twig' %}

{% block component_offcanvas_cart_actions_cart %}
    {{ parent() }}
    {% if isCartNotEmpty %}
        {% sw_include '@Storefront/storefront/component/swag-amazon-pay/amazon-pay-button.html.twig' with {
            'identifier': 'offcanvas-cart'
        } %}
    {% endif %}
{% endblock %}

I wanted to include this information to give a complete picture of what I am doing in the child theme, as it might be relevant to resolving the issue with extending the "amazon-pay-button.html.twig" template.

0

There are 0 answers