I have a list of reward points earned by the user with a limited expiration time. During checkout process, i need to let the customer view the available (unexpired) rewards and let them use it to pay for the product. So ideally some portion of the grand total will be satisfied by the rewards and the rest should go to payment. How do i apply the discount?
2 Answers
May be a little late, but I have recently implemented something same, so I thought I'd share it. You have a list of reward points available, that's great. Now, during checkout process show the available reward points to the customer, and post user entered rewards data with rest of the checkout data.
If you have implemented custom checkout process then, it would be simply setting up the discount in customer's checkout totals and pretty straight forward, magento takes care of the rest.
But if you are going with default or some third party checkout, then you can set an observer on sales_order_save_before
and inside that observer, apply discount to the magento order totals, now you will have to set grand total yourself, adjusting your discount amount as it is not a quote anymore.
After applying discount, you can easily deduct those reward points from the total available reward points.
I went with the first approach as I have implemented a custom checkout process, and moreover it seemed a little bit clean approach to me as I was working with the quote, not the order data itself.
Besides the way recommended by @Prateek, you can install a reward points extension for your site, which can handle all the configuration things, you only need to set the rules. Here are the best choice for you, I have used this extension for my site, it workks smoothly and the support team is amazing.Reward Points Pro