I have created a custom promotion in magento2. To get that working I needed to do some customization in cart which I am trying to do with salesrule_validator_process event. I needed the rulename and discount values to be modified before applying in cart.

Now In Magento1 we used to update values as below:

$result = $observer['result'];



How we can achieve the same in Magento2?

Any thoughts/suggestions are welcome.

  • Did you get any solution.. Nov 23, 2018 at 13:56

1 Answer 1


You can apply discount amount in magento2 by same event just write below code in your observer file:

$result = $observer->getEvent()->getResult();


  • It is not working. I already tried. Jul 19, 2016 at 10:44
  • This event dispatch from vendor/magento/module-sales-rule/Model/RulesApplier.php eventFix() and it will call when anybody apply coupon code from cart page Jul 19, 2016 at 11:05
  • Yes I know that. How i can use this info for setting new dicsount? Can you please explain a little bit more? Jul 19, 2016 at 11:16
  • from where you want get access your discount? you can get any model factory or collection factory by just pass it from construct function and put your logic before apply set amount. Jul 19, 2016 at 11:24
  • I tried this. $result = $observer->getEvent()->getResult(); $result->setAmount(10); $result->setBaseAmount(10); but this is not working. Jul 19, 2016 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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