setDiscountName example

$discounts = $this->calculator->recalculatePercentageDiscount(
                $discountContext->getDiscountValue(),
                $prices,
                $discountContext->isNetPrice()
            );
        }

        $discountBaseName = $discountContext->getDiscountName();
        /** @var Price $discount */
        foreach ($discounts as $discount) {
            $discountContext->setPrice($discount);
            $discountContext->setDiscountName(
                $discountBaseName . ($hasMultipleTaxes ? ' (' . $discount->getTaxRate() . '%)' : '')
            );

            $query = $this->basketQueryHelper->getInsertDiscountQuery($discountContext);
            $query->execute();

            $discountContext->setBasketId($this->basketQueryHelper->getLastInsertId());

            $query = $this->basketQueryHelper->getInsertDiscountAttributeQuery($discountContext);
            $query->execute();
        }
    }
Home | Imprint | This part of the site doesn't use cookies.