public function order(Cart
$cart, SalesChannelContext
$context, RequestDataBag
$data): CartOrderRouteResponse
{ // we use this state in stock updater class, to prevent duplicate available stock updates
$context->
addState('checkout-order-route'
);
$calculatedCart =
$this->cartCalculator->
calculate($cart,
$context);
$this->taxProviderProcessor->
process($calculatedCart,
$context);
$this->
addCustomerComment($calculatedCart,
$data);
$this->
addAffiliateTracking($calculatedCart,
$data);
$preOrderPayment = Profiler::
trace('checkout-order::pre-payment',
fn () =>
$this->preparedPaymentService->
handlePreOrderPayment($calculatedCart,
$data,
$context));
$orderId = Profiler::
trace('checkout-order::order-persist',
fn () =>
$this->orderPersister->
persist($calculatedCart,
$context));
$criteria =
new Criteria([$orderId]);
$criteria->
setTitle('order-route::order-loading'
);
$criteria ->
addAssociation('orderCustomer.customer'
) ->
addAssociation('orderCustomer.salutation'
) ->
addAssociation('deliveries.shippingMethod'
) ->
addAssociation('deliveries.shippingOrderAddress.country'
) ->
addAssociation('deliveries.shippingOrderAddress.countryState'
)