if ($order->
getOrderCustomer() === null
) { throw OrderException::
missingAssociation('orderCustomer'
);
} $customer =
$order->
getOrderCustomer()->
getCustomer();
$customerGroupId = null;
if ($customer) { $customerGroupId =
$customer->
getGroupId();
} $billingAddress =
$order->
getBillingAddress();
$countryStateId = null;
if ($billingAddress) { $countryStateId =
$billingAddress->
getCountryStateId();
} $options =
[ SalesChannelContextService::CURRENCY_ID =>
$order->
getCurrencyId(),
SalesChannelContextService::LANGUAGE_ID =>
$order->
getLanguageId(),
SalesChannelContextService::CUSTOMER_ID =>
$order->
getOrderCustomer()->
getCustomerId(),
SalesChannelContextService::COUNTRY_STATE_ID =>
$countryStateId,
SalesChannelContextService::CUSTOMER_GROUP_ID =>
$customerGroupId,