Forked from strangerstudios/my_pmpro_checkout_level.php
Last active
December 5, 2021 13:07
-
-
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.
This file contains hidden or 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
<?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"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.