What you'd probably need to do is create a "Donation" product, then when it is added to the order record on the order line as an order line property (https://vendr.net/docs/core/1-3-0/key-concepts/properties/) the amount the customer wishes to donate, then in your order line calculators CalculateOrderLineUnitPrice return this price as the order line unit price.
Give your product any price as you’ll override it in the order line calculator. You’ll then need to render an input field on the product page for your discount for the customer to enter their donation amount. You’ll need to capture this and pass it in as a custom property when you add the product to the order. Then in your order line calculator you can read that property from the order line and return that as the unit price.
How to go about donations?
Hello,
Is it possible to set up donations in Vendr?
Basically have a user click the donate button, have them type in their amount and run them through the checkout with the amount they typed in?
Thanks!
Hey Alex,
You should be able to do this by implementing a custom
IOrderLineCalculator
What you'd probably need to do is create a "Donation" product, then when it is added to the order record on the order line as an order line property (https://vendr.net/docs/core/1-3-0/key-concepts/properties/) the amount the customer wishes to donate, then in your order line calculators
CalculateOrderLineUnitPrice
return this price as the order line unit price.Hope this helps
Matt
Thanks for your answer Matt.
I've created the Donation product, but i have to set a price on it when I set up the product in the shop as it is a required field.
Where and how would I override that price say, if I wanted the customer to enter an amount and click the 'donate' button?
Hey Alex
Give your product any price as you’ll override it in the order line calculator. You’ll then need to render an input field on the product page for your discount for the customer to enter their donation amount. You’ll need to capture this and pass it in as a custom property when you add the product to the order. Then in your order line calculator you can read that property from the order line and return that as the unit price.
Hope this helps
Matt
is working on a reply...