Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andrewlimaza/08c5cfaf9000d2872fc943d5e753fb02 to your computer and use it in GitHub Desktop.
Save andrewlimaza/08c5cfaf9000d2872fc943d5e753fb02 to your computer and use it in GitHub Desktop.
Adjust checkout pricing for existing members for Paid Memberships Pro.
<?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 5, 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 level 2.
if ( pmpro_hasMembershipLevel('2') && '5' == $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