Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save greathmaster/960287af84c19ddd4217 to your computer and use it in GitHub Desktop.
Save greathmaster/960287af84c19ddd4217 to your computer and use it in GitHub Desktop.
Provide a discount for members who are expired
function custom_renewal($level)
{
global $wpdb, $current_user;
$levelshistory = $wpdb->get_results("SELECT * FROM $wpdb->pmpro_memberships_users WHERE user_id = '$current_user->ID' ORDER BY id DESC");
if($levelshistory && $levelshistory[0]->status == 'expired' && $levelshistory[0]->membership_id == $level->id)
{
$level->initial_payment = ($level->initial_payment/2);
}
return $level;
}
add_filter("pmpro_checkout_level", "custom_renewal");
@laurenhagan0306
Copy link

This recipe is included in the blog post on "Offer Expired and “Old” Members a Membership Renewal Discount for Coming Back" at Paid Memberships Pro here: https://www.paidmembershipspro.com/offer-expired-old-members-membership-renewal-discount-coming-back/

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