Created
February 20, 2014 18:22
-
-
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.
This file contains 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
/* | |
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"); |
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
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/