I am trying to create my custom reward points module. I need to apply discount to customer based on his reward points when he click use my rewards in cart/checkout page. For that i am followed below link

How to add fee to order totals in Magento 2.

It's adding discount to cart when i enter into checkout page, but i need to give authority to customer to apply rewards or not. If he select apply rewards then only discount to be add to cart totals.

1 Answer 1


This is a very comprehensive tasks, so providing exact code that you can use directly is impossible. But yes I can suggest what approach you can use.

I would suggest you to take some reference from Magento Enterprise code(if you have access). I make an understanding on how Magento let it done in case of store credits and this is how Magento manages store credit on checkout.

  1. Whenever user clicks on "Apply Store Credit".
  2. Magento fires an REST Api request and performs action.
  3. Same if user needs to remove Store Credit.

You can manage totals at that point on success on ajax.

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.