Forked from strangerstudios/my_pmpro_checkout_level_renewal_pricing.php
Last active
September 16, 2022 17:44
-
-
Save kimwhite/695388595eb259e2e5a5c0875b4c1d78 to your computer and use it in GitHub Desktop.
$25 discount when renewing the same level in Paid Memberships Pro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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