isAutomaticDiscount example

// if we dont have a scope             // then skip it, it might not belong to us             if (!$discountItem->hasPayloadValue('discountScope')) {
                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;
            }

            
Home | Imprint | This part of the site doesn't use cookies.