Forked from andrewlimaza/pmpro-adjust-price-for-members.php
Last active
April 12, 2021 20:20
-
-
Save travislima/d7ebb0ba40f7273e28d391a9f930d46c to your computer and use it in GitHub Desktop.
Adjust checkout pricing for existing members for 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 | |
/** | |
* This will adjust membership pricing depending on users current level and level checking out for. See line 10. | |
* This will show you how to adjust the initial amount and/or the recurring amount. If the existing level, in this case 2, is not a recurring level please uncomment lines 12-14. | |
* Add this code (L8 - L20) to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function pmpro_adjust_price_for_members( $level ) { | |
// Adjust price for existing members that currently have Membership level id 1 and are upgrading to Membership Level id 2. | |
if ( pmpro_hasMembershipLevel('1') && '2' == $level->id ) { | |
$level->initial_payment = '25.00'; // Change the initial amount. | |
// $level->billing_amount = '50.00'; // Change the recurring amount. - Uncomment to take affect | |
// $level->cycle_number = '1'; // Change the billing cycle - Uncomment to take affect | |
// $level->cycle_period = 'Month'; // Change the cycle period - Uncomment to take affect | |
} | |
return $level; | |
} | |
add_filter( 'pmpro_checkout_level', 'pmpro_adjust_price_for_members' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This recipe is included in the blog post on "Offer members a discounted rate for upgrading to a higher level" at Paid Memberships Pro here: https://www.paidmembershipspro.com/offer-members-a-discounted-rate-for-upgrading-to-a-new-level/