I need to implement some kind of reward point. On the checkout form, user can use their point and then the total price will be deducted by the amount of points used by the user. Could you give me some instructions for this case?
Sure. For this you'll probably need to create a new database table to store the accumulated points for a member and use the events system of Vendr (https://vendr.net/docs/core/1-3-0/key-concepts/events/) to hook into for example the order finalized event and then calculate how many points that order is worth and record that in the database against a member reference.
On checkout you'd probably then need to extend this in some way to either automatically display the members accumulated points / value and have a button to say "redeem my points" or have them automatically be deducted. I guess it depends on the approach the customer wants.
In order to redeem them, I'd probably do it via the discounts system so either as an automatic discount (if they should be automatically deducted), or a code based discount (if they need to be manually deducted) then when they click "redeem my points" this just applies the "rewardpoints" discount code on the order.
In order to work out the discount, you'd then need to create a new discount reward provider https://vendr.net/docs/core/1-3-0/key-concepts/discount-rules-and-rewards/ that would grab the current member, lookup their accumulated points and then work out a price discount for them and return it as an Order TotalPrice discount.
Finally, you'd then probably need some other event handler on order finalize to say "if this order uses reward points, deduct this from the accrued points in the database" so that these get deducted as they are used up.
This would be a rather basic implementation. If you required the points to have a limited life span, you'd probably need to record dates against the points when they are added and check this date when you are working out the discount to apply, only counting valid points.
I think this would be the general outline of how you could achieve this.
Another option I thought of is do you generate gift cards and essentially alter the remaining balance on them as then all the logic for using them is already in place. It would just mean you gift cards section would get rather full with "reward point gift card" if you are applying them for every customer.
Reward Point in Checkout
Hi Matt,
I need to implement some kind of reward point. On the checkout form, user can use their point and then the total price will be deducted by the amount of points used by the user. Could you give me some instructions for this case?
Thanks
Hi Nalsya,
Sure. For this you'll probably need to create a new database table to store the accumulated points for a member and use the events system of Vendr (https://vendr.net/docs/core/1-3-0/key-concepts/events/) to hook into for example the order finalized event and then calculate how many points that order is worth and record that in the database against a member reference.
On checkout you'd probably then need to extend this in some way to either automatically display the members accumulated points / value and have a button to say "redeem my points" or have them automatically be deducted. I guess it depends on the approach the customer wants.
In order to redeem them, I'd probably do it via the discounts system so either as an automatic discount (if they should be automatically deducted), or a code based discount (if they need to be manually deducted) then when they click "redeem my points" this just applies the "rewardpoints" discount code on the order.
In order to work out the discount, you'd then need to create a new discount reward provider https://vendr.net/docs/core/1-3-0/key-concepts/discount-rules-and-rewards/ that would grab the current member, lookup their accumulated points and then work out a price discount for them and return it as an Order
TotalPrice
discount.Finally, you'd then probably need some other event handler on order finalize to say "if this order uses reward points, deduct this from the accrued points in the database" so that these get deducted as they are used up.
This would be a rather basic implementation. If you required the points to have a limited life span, you'd probably need to record dates against the points when they are added and check this date when you are working out the discount to apply, only counting valid points.
I think this would be the general outline of how you could achieve this.
Another option I thought of is do you generate gift cards and essentially alter the remaining balance on them as then all the logic for using them is already in place. It would just mean you gift cards section would get rather full with "reward point gift card" if you are applying them for every customer.
Matt
is working on a reply...