Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Created February 20, 2014 18:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save strangerstudios/9120040 to your computer and use it in GitHub Desktop.
Save strangerstudios/9120040 to your computer and use it in GitHub Desktop.
Increase price at checkout if a certain value (e.g. added via PMPro Register Helper) is set.
/*
If a user checked option1, then add $100 to the price.
*/
function my_pmpro_checkout_level($level)
{
if(!empty($_REQUEST['option1']))
{
$level->initial_payment = $level->initial_payment + 100;
//$level->billing_amount = $level->billing_amount + 100; //to update recurring payments too
}
return $level;
}
add_filter("pmpro_checkout_level", "my_pmpro_checkout_level");
@laurenhagan0306
Copy link

This recipe is included in the blog post on "Modify Level Price at Checkout Based on User-Selections" at Paid Memberships Pro here: https://www.paidmembershipspro.com/modify-level-price-at-checkout-based-on-user-selections/

@ideadude
Copy link

The new version of this gist can be found here: https://gist.github.com/ideadude/db09dd398dfc690a4588d427d2810837

It was updated to support PayPal Express and other offsite gateways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment