Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CustomerGroupRetriever.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Sales\Model;
7 
10 
14 class CustomerGroupRetriever implements \Magento\Customer\Model\Group\RetrieverInterface
15 {
19  private $quoteSession;
20 
24  private $groupManagement;
25 
30  public function __construct(Quote $quoteSession, GroupManagementInterface $groupManagement)
31  {
32  $this->quoteSession = $quoteSession;
33  $this->groupManagement = $groupManagement;
34  }
35 
39  public function getCustomerGroupId()
40  {
41  if ($this->quoteSession->getQuoteId() && $this->quoteSession->getQuote()) {
42  return $this->quoteSession->getQuote()->getCustomerGroupId();
43  }
44  return $this->groupManagement->getNotLoggedInGroup()->getId();
45  }
46 }
__construct(Quote $quoteSession, GroupManagementInterface $groupManagement)