private readonly AbstractProductListRoute
$productListRoute,
private readonly LineItemFactoryRegistry
$lineItemFactoryRegistry ) { } #[Route(path: '/checkout/line-item/delete/{id}', name: 'frontend.checkout.line-item.delete', defaults: ['XmlHttpRequest' => true], methods: ['POST', 'DELETE'])]
public function deleteLineItem(Cart
$cart, string
$id, Request
$request, SalesChannelContext
$context): Response
{ return Profiler::
trace('cart::delete-line-item',
function D
) use ($cart,
$id,
$request,
$context) { try { if (!
$cart->
has($id)) { throw CartException::
lineItemNotFound($id);
} $cart =
$this->cartService->
remove($cart,
$id,
$context);
if (!
$this->
traceErrors($cart)) { $this->
addFlash(self::SUCCESS,
$this->
trans('checkout.cartUpdateSuccess'
));
} } catch (\Exception
) { $this->
addFlash(self::DANGER,
$this->
trans('error.message-default'
));
}