# context.customer.getGroup() ist null

**URL:** <https://forum.shopware.com/t/context-customer-getgroup-ist-null/85947>\
**Category:** Programmierung\
**Created:** [12. März 2021 um 19:09 UTC](https://forum.shopware.com/t/context-customer-getgroup-ist-null/85947 "2021-03-12T19:09:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pr-kw](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@pr-kw](https://forum.shopware.com/u/pr-kw)\
**Post date:** [12. März 2021 um 19:09 UTC](https://forum.shopware.com/t/context-customer-getgroup-ist-null/85947/1 "2021-03-12T19:09:07Z")

</div>

Wenn ich im Template die Kundengruppe ausgebe: {{ context.customer.getGroup() }} ist immer null.

Auch wenn der Kunde in einer Gruppe ist (Bestätigt).

{{ context.customer.getGroupId() }} enthält die korrekte Gruppen ID, aber ich hätte gerne den Gruppen-Namen. Ist das ein Bug oder mache ich was falsch? Gibt es eine Hack um an die Gruppe zu kommen?

---

<div class="post-metadata">

**Author:** ![SauerC](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@SauerC](https://forum.shopware.com/u/SauerC)\
**Post date:** [31. März 2023 um 08:04 UTC](https://forum.shopware.com/t/context-customer-getgroup-ist-null/85947/2 "2023-03-31T08:04:24Z")

</div>

Würde mich auch nochmal interessieren, stehe vor einem ähnlichen problem, ich möchte gerne die Preise ausblenden sofern man noch nicht eingeloggt ist und bin auf context.customer gestoßen, hab aber noch nichts weiteres dazu gefunden, ob es mit aktiviertem Cache funktioniert.

---

<div class="post-metadata">

**Author:** ![Max\_Shop](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Max\_Shop](https://forum.shopware.com/u/Max_Shop)\
**Post date:** [31. März 2023 um 08:51 UTC](https://forum.shopware.com/t/context-customer-getgroup-ist-null/85947/3 "2023-03-31T08:51:21Z")

</div>

Copy & Past wie Shopware das macht:

`window.customerLoggedInState = {{ context.customer is not null and not context.customer.guest ? 1 : 0 }};`

---

<div class="post-metadata">

**Author:** ![AlexGalax](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/alexgalax/32/9925_2.png) [@AlexGalax](https://forum.shopware.com/u/AlexGalax)\
**Post date:** [31. März 2023 um 08:55 UTC](https://forum.shopware.com/t/context-customer-getgroup-ist-null/85947/4 "2023-03-31T08:55:16Z")

</div>

Name der Kundengruppe hier:  
`{{ context.currentCustomerGroup.name }}`

---

<div class="post-metadata">

**Author:** ![chapter2](https://avatars.discourse-cdn.com/v4/letter/c/f4b2a3/32.png) [@chapter2](https://forum.shopware.com/u/chapter2)\
**Post date:** [31. März 2023 um 17:50 UTC](https://forum.shopware.com/t/context-customer-getgroup-ist-null/85947/5 "2023-03-31T17:50:28Z")

</div>

Für Gäste ist `context.customer` stets `null`.  
Für eingeloggte Benutzer sollte der Wert von @AlexGalax funktionieren.
