public function buildPlaceholderItem(string $code, int $currencyPrecision): LineItem
    {
        // void duplicate codes with other items
        // that might not be from the promotion scope
        $uniqueKey = self::PLACEHOLDER_PREFIX . $code;

        $item = new LineItem($uniqueKey, $this->lineItemType, 1);
        $item->setLabel($uniqueKey);
        $item->setGood(false);

        // this is used to pass on the code for later usage
        $item->setPayload(['code' => $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, $currencyPrecision));

        return $item;
    }
public function buildPlaceholderItem(string $code, int $currencyPrecision): LineItem
    {
        // void duplicate codes with other items
        // that might not be from the promotion scope
        $uniqueKey = self::PLACEHOLDER_PREFIX . $code;

        $item = new LineItem($uniqueKey, $this->lineItemType, 1);
        $item->setLabel($uniqueKey);
        $item->setGood(false);

        // this is used to pass on the code for later usage
        $item->setPayload(['code' => $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, $currencyPrecision));

        return $item;
    }
public function buildPlaceholderItem ( string $ code , int $ currencyPrecision ) : LineItem { // void duplicate codes with other items // that might not be from the promotion scope $ uniqueKey = self :: PLACEHOLDER_PREFIX . $ code ; $ item = new LineItem ( $ uniqueKey , $ this -> lineItemType , 1 ) ; $ item -> setLabel ( $ uniqueKey ) ; $ item -> setGood ( false ) ; // this is used to pass on the code for later usage $ item -> setPayload ( [ 'code' => $ 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 , $ currencyPrecision ) ) ; return $ item ; }
Builds a new placeholder promotion line item that does not have
any side effects for the calculation. It will contain the code
within the payload which can then be used to create a real promotion item.

@throws InvalidPayloadException
@throws InvalidQuantityException
Builds a new placeholder promotion line item that does not have any side effects for the calculation . It will contain the code within the payload which can then be used to create a real promotion item .