Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Last active December 17, 2015 17:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save strangerstudios/5650417 to your computer and use it in GitHub Desktop.
Save strangerstudios/5650417 to your computer and use it in GitHub Desktop.
Credit one level's cost to another level at checkout with PMPro.
/*
Upgrade Pricing. Make sure to change "$level->id == 15" to check for your own level ID.
*/
function my_pmpro_checkout_level($level)
{
$user_level = pmpro_getMembershipLevelForUser();
//if($level->id == 15 && pmpro_hasMembershipLevel(6)) //to check for a specific level combo
if(!empty($user_level->initial_payment))
{
max(0, $level->initial_payment = $level->initial_payment - $user_level->initial_payment);
}
return $level;
}
add_filter("pmpro_checkout_level", "my_pmpro_checkout_level");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment