// customer
$customer = null;
if (\
array_key_exists(SalesChannelContextService::CUSTOMER_ID,
$options) &&
$options[SalesChannelContextService::CUSTOMER_ID
] !== null
) { // load logged in customer and set active addresses
$customer =
$this->
loadCustomer($options,
$base->
getContext());
} $shippingLocation =
$base->
getShippingLocation();
if ($customer) { /** @var CustomerAddressEntity $activeShippingAddress */
$activeShippingAddress =
$customer->
getActiveShippingAddress();
$shippingLocation = ShippingLocation::
createFromAddress($activeShippingAddress);
} $customerGroup =
$base->
getCurrentCustomerGroup();
if ($customer) { $criteria =
new Criteria([$customer->
getGroupId()]);
$criteria->
setTitle('context-factory::customer-group'
);
/** @var CustomerGroupEntity $customerGroup */
$customerGroup =
$this->customerGroupRepository->
search($criteria,
$base->
getContext())->
first() ??
$customerGroup;
}