addPromotionAddedNotice example

// also add our discounted items and their meta data             // to our discount line item payload             $discountItem->setPayloadValue(
                'composition',
                $this->discountCompositionBuilder->buildCompositionPayload($result->getCompositionItems())
            );

            // add our discount item to the cart             $calculated->add($discountItem);

            $this->addPromotionAddedNotice($original$calculated$discountItem);

            // recalculate for every new discount to get the correct             // prices for any upcoming iterations             $this->calculateCart($calculated$context);
        }
    }

    /** * This function builds a complete list of promotions * that are excluded somehow. * The validation which one to take will be done later. * * @return array<mixed, boolean> */
if (\array_key_exists($promotionId$exclusions)) {
                $toCalculate->addErrors(new PromotionNotEligibleError($discountItem->getDescription() ?? $discountItem->getId()));

                continue;
            }

            $deliveryItemAdded = $this->calculateDeliveryPromotion($toCalculate$discountItem$context$notDiscountedDeliveriesValue);

            if ($deliveryItemAdded) {
                // ensure that a lineItem will be added to cart if a discount has been added                 $this->addFakeLineitem($toCalculate$discountItem$context);
                $this->addPromotionAddedNotice($original$toCalculate$discountItem);
            } else {
                $this->addPromotionDeletedNotice($original$toCalculate$discountItem);
            }
        }
    }

    /** * This function builds a complete list of promotions * that are excluded somehow. * The validation which one to take will be done later. * * @return array<mixed, boolean> */
Home | Imprint | This part of the site doesn't use cookies.