getDiscountType example

$this->calculator = $calculator;
    }

    /** * {@inheritdoc} */
    public function addProportionalDiscount(DiscountContext $discountContext)
    {
        $prices = $this->getPositionPrices($discountContext);
        $hasMultipleTaxes = $this->calculator->hasDifferentTaxes($prices);

        if ($discountContext->getDiscountType() === self::DISCOUNT_ABSOLUTE) {
            $discounts = $this->calculator->calculate(
                $discountContext->getDiscountValue(),
                $prices,
                $discountContext->isNetPrice()
            );
        } else {
            $discounts = $this->calculator->recalculatePercentageDiscount(
                $discountContext->getDiscountValue(),
                $prices,
                $discountContext->isNetPrice()
            );
        }
Home | Imprint | This part of the site doesn't use cookies.