Out of the box Magento has no possibility to handle donations for charities. With the Magento 2 Experius Donation Product module it is very easy to add this function to your Magento 2 Webshop installation.
The extension is free and available on both github or the Magento marketplace.
It’s pretty simple. This is what we are good at and we would like to do some good. So hopefully, by making this free and high quality donation extension for Magento 2, store owners will add this module to their stores and start collecting for local charities.
How it works
The module adds a new product type called ‘Donation Product’. By adding a donation product to your catalog you can add your own (local) charities. A charity block can be displayed on several standard locations in your Magento 2 webshop. For example your cart, homepage, checkout or sidebar. Via this block the customer can add a charity to his cart with a self chosen amount. You can read the entire manual on github.
About the code
To provide the best and most stable solution we wanted to use as much of the standard functions, provided by the Magento 2 platform, as possible. We had two options. Creating a extra total, or adding a new product type. We chose to add a new product type instead of extra cart total. Why?
- The first reasons is that extra totals, somehow, gets you in trouble. Especially with standard connections to ERP’s, PSP’s and other 3rd party systems.
- Second reason is that we can handle more than one donation per cart.
- Third reason is that a store owner can easily add there own local charities and sell them as if they where products. Including pictures, descriptions and all other product features. It therefore has a flat learning curve and won’t need a additional manual.
- Fourth reason is, thou in most countries you don’t need to charge tax for a donation product but using a product type makes this very flexible out of the box.
- Fifth reason. If you compare the total vs product type solution (with the requirement of multiple donations possibility in mind) the product type solution wins in terms of the small amount of custom code that is needed.
The store owner has to be the one that pays the charities with the collected amount. To make this easy we added a extra Report so the store owner can calculate the donated amount per Charity pretty easy. Because every store owner has a different way of deciding when order is completed or paid, we’ve added added both the order status and the is_invoiced information to the reporting grid. This way the store owner can decide how to filter the information to get the right report and only export the records which have been paid for.