public function create(string
$token, string
$salesChannelId, array
$options =
[]): SalesChannelContext
{ // we split the context generation to allow caching of the base context
$base =
$this->baseContextFactory->
create($salesChannelId,
$options);
// 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();