Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
CustomerGroupRetriever Class Reference
Inheritance diagram for CustomerGroupRetriever:
RetrieverInterface

Public Member Functions

 __construct (Quote $quoteSession, GroupManagementInterface $groupManagement)
 
 getCustomerGroupId ()
 

Detailed Description

Class for getting customer group from quote session for adminhtml area.

Definition at line 14 of file CustomerGroupRetriever.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Quote  $quoteSession,
GroupManagementInterface  $groupManagement 
)
Parameters
Quote$quoteSession
GroupManagementInterface$groupManagement

Definition at line 30 of file CustomerGroupRetriever.php.

31  {
32  $this->quoteSession = $quoteSession;
33  $this->groupManagement = $groupManagement;
34  }

Member Function Documentation

◆ getCustomerGroupId()

getCustomerGroupId ( )

Retrieve customer group id.

Returns
int
Since
101.0.0

Implements RetrieverInterface.

Definition at line 39 of file CustomerGroupRetriever.php.

40  {
41  if ($this->quoteSession->getQuoteId() && $this->quoteSession->getQuote()) {
42  return $this->quoteSession->getQuote()->getCustomerGroupId();
43  }
44  return $this->groupManagement->getNotLoggedInGroup()->getId();
45  }

The documentation for this class was generated from the following file: