This code adds a donation number field before the order review on the checkout page in WooCommerce. The field:
- Enables customers to donate any amount using the number field.
- The donation amount is added to the sub totals table.
- The amount updates dynamically when the value for the number field is changed without refreshing the checkout page as seen in the demo video.
The code also adds the donation amount to the Order details page and the woocommerce > orders > items table in the backend so its also included on email invoices for orders.
Install the zip folder as a new plugin or copy & paste the PHP code to the end of your child themes functions file or custom functionality plugin.