#[Route(path: '/store-api/checkout/order', name: 'store-api.checkout.cart.order', methods: ['POST'], defaults: ['_loginRequired' => true, '_loginRequiredAllowGuest' => true])]
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'
)