检查(在 twig 模板中)Shopware 6 客户是否属于特定客户组

问题描述 投票:0回答:1

我知道这个 Shopware 6 树枝的状况:

{% if context.customer is defined %}
    do show 
{% endif %}

但是如何检查客户是否属于特定客户组呢?

twig shopware shopware6
1个回答
0
投票

您可以查看

SalesChannelContext
类或
dump
模板中的上下文以查看可用的内容。

您在上下文中可以使用

currentCustomerGroup

{% if context.currentCustomerGroup.id == 'cfbd5018d38d41d8adca10d94fc8bdd6' %}
    do show 
{% endif %}
© www.soinside.com 2019 - 2024. All rights reserved.