Search code examples
twigshopwareshopware6

Shopware 6 : Check globally if customer is connected


How to check globally if customer is logged in in all template of Shopware 6 (not for a specific route) ? I want to check this variable using template twig.


Solution

  • You can use the following if-statement in any template to check whether a customer is currently logged-in:

    {% if context.customer is defined %}
        customer is logged in
    {% endif %}