return $this->
renderStorefront('@Storefront/storefront/page/account/order-history/index.html.twig',
['page' =>
$page]);
} #[Route(path: '/account/order/cancel', name: 'frontend.account.order.cancel', methods: ['POST'])]
public function cancelOrder(Request
$request, SalesChannelContext
$context): Response
{ $cancelOrderRequest =
new Request();
$cancelOrderRequest->request->
set('orderId',
$request->
get('orderId'
));
$cancelOrderRequest->request->
set('transition', 'cancel'
);
$event =
new CancelOrderRouteRequestEvent($request,
$cancelOrderRequest,
$context);
$this->eventDispatcher->
dispatch($event);
$this->cancelOrderRoute->
cancel($event->
getStoreApiRequest(),
$context);
if ($context->
getCustomer() &&
$context->
getCustomer()->
getGuest() === true
) { return $this->
redirectToRoute( 'frontend.account.order.single.page',
[ 'deepLinkCode' =>
$request->
get('deepLinkCode'
),
] );
}