Last active
October 27, 2022 15:53
-
-
Save dparker1005/bacd333e262a4072fb182fef84a79ea1 to your computer and use it in GitHub Desktop.
Round down initial payment price for users switching levels. Useful to make prorated prices look more friendly.
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
<?php | |
// Copy from below here... | |
/* | |
* Round down initial payment price for users switching levels. | |
* Useful to make prorated prices look more friendly. | |
*/ | |
function my_pmpro_checkout_level_round_down_initial_payment( $level ) { | |
// We only want to round down prorations. | |
if ( ! pmpro_hasMembershipLevel() ) { | |
return $level; | |
} | |
// Round down to an integer. | |
$level->initial_payment = floor( $level->initial_payment ); | |
// Round down to nearest 25. | |
$level->initial_payment -= $level->initial_payment % 25; | |
return $level; | |
} | |
add_action( 'pmpro_checkout_level', 'my_pmpro_checkout_level_round_down_initial_payment', 15, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment