Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Last active February 19, 2019 23:24
Show Gist options
  • Save andrewlimaza/fc51691daab073d0ed63 to your computer and use it in GitHub Desktop.
Save andrewlimaza/fc51691daab073d0ed63 to your computer and use it in GitHub Desktop.
Recurring Donation for PMPRO
This function is used with Paidmemberships Pro Donations addon.
This adds the functionality of making the users donation added to their recurring billing amount.
//set price
function pmprodon_pmpro_donation_recurring($level)
{
if(isset($_REQUEST['donation']))
$donation = preg_replace("[^0-9\.]", "", $_REQUEST['donation']);
else
return $level;
if(!empty($donation))
{
//save initial payment amount
global $pmprodon_original_initial_payment;
$pmprodon_original_initial_payment = $level->billing_amount;
//add donation
$level->billing_amount = $level->billing_amount + $donation;
}
return $level;
}
add_filter("pmpro_checkout_level", "pmprodon_pmpro_donation_recurring", 99);
@zagarskas
Copy link

Brilliant. Any tips on how to get this into the admin panel as an optional checkbox for a membership level?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment