public function onLineItemAdded(BeforeLineItemAddedEvent
$event): void
{ if ($event->
getLineItem()->
getType() === PromotionProcessor::LINE_ITEM_TYPE
) { $code =
$event->
getLineItem()->
getReferencedId();
if ($code !== null &&
$code !== ''
) { $this->
addCode($code,
$event->
getCart());
} } } /**
* This function is called whenever a line item is being removed
* from the cart from within a controller.
* We verify if it is a promotion item, and also remove that
* code from our extension, if existing.
*/
public function onLineItemRemoved(BeforeLineItemRemovedEvent
$event): void
{