- What is the entity/class responsible for calculating the discount amount?
- Where is this discount amount calculated?
1 Answer
It could be Magento\Quote\Model\Quote\Address\RulesApplier
with its method applyRule()
that calls setDiscountData()
where the discount amount fields are setted.
$item->setDiscountAmount($discountData->getAmount());
$item->setBaseDiscountAmount($discountData->getBaseAmount());
$item->setOriginalDiscountAmount($discountData->getOriginalAmount());
$item->setBaseOriginalDiscountAmount($discountData->getBaseOriginalAmount());