isRequirementValid example

continue;
            }

            if (!$discountItem->hasPayloadValue('discountScope')) {
                continue;
            }

            if ($discountItem->getPayloadValue('discountScope') !== PromotionDiscountEntity::SCOPE_DELIVERY) {
                continue;
            }

            if (!$this->isRequirementValid($discountItem$toCalculate$context)) {
                // hide the notEligibleErrors on automatic discounts                 if (!$this->isAutomaticDisount($discountItem)) {
                    $this->addPromotionNotEligibleError($discountItem->getLabel() ?? $discountItem->getId()$toCalculate);
                }

                continue;
            }

            // if promotion is on exclusions stack it is ignored             if (!$discountItem->hasPayloadValue('promotionId')) {
                continue;
            }


            // deliveries have their own processor and calculator             if ($discountItem->getPayloadValue('discountScope') === PromotionDiscountEntity::SCOPE_DELIVERY) {
                continue;
            }

            $isAutomaticDiscount = $this->isAutomaticDiscount($discountItem);

            // we have to verify if the line item is still valid             // depending on the added requirements and conditions.             if (!$this->isRequirementValid($discountItem$calculated$context)) {
                // hide the notEligibleErrors on automatic discounts                 if (!$isAutomaticDiscount) {
                    $this->addPromotionNotEligibleError($discountItem->getLabel() ?? $discountItem->getId()$calculated);
                }

                continue;
            }

            // if promotion is on exclusions stack it is ignored             if (!$discountItem->hasPayloadValue('promotionId')) {
                continue;
            }
Home | Imprint | This part of the site doesn't use cookies.