Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kimwhite/695388595eb259e2e5a5c0875b4c1d78 to your computer and use it in GitHub Desktop.
Save kimwhite/695388595eb259e2e5a5c0875b4c1d78 to your computer and use it in GitHub Desktop.
$25 discount when renewing the same level in Paid Memberships Pro
<?php // do not copy this line.
/**
* This recipe does will allow you to discount the price when someone renews at the same level for 1 level.
* Change line 14 to the amount to be discounted, change line 16 level 1 to the level ID for your own level.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_checkout_level_renewal_pricing($level)
{
$discount = 70; //change this
if(pmpro_hasMembershipLevel('1') && $level->id == 1) //might want to check for specific levels here
$level->initial_payment = max(0, $level->initial_payment - $discount);
return $level;
}
add_filter('pmpro_checkout_level', 'my_pmpro_checkout_level_renewal_pricing');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment