$lineItem =
$this->promotionItemBuilder->
buildPlaceholderItem($code);
$cart =
$this->cartService->
add($cart,
$lineItem,
$context);
// we basically show all cart errors or notices
// at the moments its not possible to show success messages with "green" color
// from the cart...thus it has to be done in the storefront level
// so if we have an promotion added notice, we simply convert this to
// a success flash message
$addedEvents =
$cart->
getErrors()->
filterInstance(PromotionCartAddedInformationError::
class);
if ($addedEvents->
count() > 0
) { $this->
addFlash(self::SUCCESS,
$this->
trans('checkout.codeAddedSuccessful'
));
return $this->
createActionResponse($request);
} // if we have no custom error message above
// then simply continue with the default display
// of the cart errors and notices
$this->
traceErrors($cart);
} catch (\Exception
) {