$uniqueKey = self::PLACEHOLDER_PREFIX .
$code;
$item =
new LineItem($uniqueKey, PromotionProcessor::LINE_ITEM_TYPE
);
$item->
setLabel($uniqueKey);
$item->
setGood(false
);
// this is used to pass on the code for later usage
$item->
setReferencedId($code);
// this is important to avoid any side effects when calculating the cart
// a percentage of 0,00 will just do nothing
$item->
setPriceDefinition(new PercentagePriceDefinition(0
));
return $item;
} /**
* Builds a new Line Item for the provided discount and its promotion.
* It will automatically reference all provided "product" item Ids within the payload.
*
* @throws CartException
* @throws UnknownPromotionDiscountTypeException
*/