Craft commerce 3 - Module - Lineitem - Get usergroup I have the following code working. The only thing i have to do is to check which usergroup is the customer in. Is there a simple way to check what usergroup is the customer in? This is my first custom module.
Event::on(
LineItems::class,
LineItems::EVENT_POPULATE_LINE_ITEM,
function(LineItemEvent $event) {

    // @var LineItem $lineItem
    $lineItem = $event-&gt;lineItem;
    
    // @var bool $isNew
    $isNew = $event-&gt;isNew;
    
    $purchasable = $lineItem-&gt;getPurchasable();
    $variant = $purchasable-&gt;getProduct();

    // IF GUEST USER  &gt; NORMAL PRICE
    $lineItem-&gt;salePrice = $lineItem-&gt;getSalePrice();
    $lineItem-&gt;price = $lineItem-&gt;getPrice();

    // IF USER IS IN DEALER USERGROUP &gt; DEALER PRICE
    $lineItem-&gt;salePrice = $variant-&gt;dealerPrice;
    $lineItem-&gt;price = $variant-&gt;dealerPrice;
    
}

);
Remembering a) that not all customers are users and b) that a user can be in one, or more, groups.....then something like this can be used to check if a user is in a particular group:
            $order = $lineItem-&gt;getOrder();
            $user = Craft::$app-&gt;users-&gt;getUserByUsernameOrEmail($order-&gt;email);
            if ($user){
                foreach ($user-&gt;getGroups() as $group) {
                    if ($group-&gt;id == someParticularValue){
                        //do stuff
                    }
                }
            }