Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ideadude/db09dd398dfc690a4588d427d2810837 to your computer and use it in GitHub Desktop.
Save ideadude/db09dd398dfc690a4588d427d2810837 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.
<?php
/**
* If a user checked option1, then add $100 to the price.
*/
function my_pmpro_checkout_level($level) {
if( ! empty( $_REQUEST['option1'] ) || ! empty( $_SESSION['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");
@ideadude
Copy link
Author

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/

@emilianoph
Copy link

emilianoph commented Dec 5, 2021

Since a one day ago, I am trying to integrate an option that I consider very basic and extremely needed. How to adapt this idea to change the checkout price, when the user change the payment method. Currently, only when he selects the check method, a "simple" text box with information arises.
I think that it is very demanded the idea that depending on the selection different taxes are applied in order to translate to the user the cost of the gateway fees. Maybe the exception with 0% taxes would be check that usually has extra cost.
Thus, every time the user click on the payment methods radio buttons:
-the price changes.
-a box with the tax applied is shown.
-a total value of price is shown.

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