I need to give Quote Item level manual Discount for selected cart items. After giving discount Cart Item row total will change. As can't modify the product price so custom price solution is also not working.

I tried with a new discount total but it gives a discount on the whole cart.

Anyone, please suggest the best approach for giving a discount on Cart item level without modifying product price.

  • hello @Panakj, got solution for it? Jul 30 '19 at 10:52

You can create a plugin for Magento\SalesRule\Model\Validator::process -

    class Myplugin

        protected $discountFactory;

        public function __construct(\Magento\SalesRule\Model\Rule\Action\Discount\DataFactory $discountFactory){
        $this->discountFactory = $discountFactory;

    public function aroundProcess(
        \Magento\SalesRule\Model\Validator $subject,
        \Closure $proceed,
        \Magento\SalesRule\Model\Validator $validator
        $returnValue = $proceed($item);

        $discountData = $this->discountFactory->create();


        $this->setDiscountData($discountData, $item);

        return $returnValue;

Replace the [my_discount_amount] with your discount amount.

  • 1
    Thanks. I am getting Call to undefined method setDiscountData error. Any idea ? Jun 6 '19 at 9:36
  • hello, @NoamN pls update full code, also this code sets the mannual discount on each quote item? Jul 30 '19 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.