Forked from greathmaster/pmpro-prorate-initial-payment.php
Created
September 11, 2020 11:31
-
-
Save femiyb/01f032555098d41954306e07330511e5 to your computer and use it in GitHub Desktop.
Prorate the initial payment. Useful for subscriptions that occur on the first of every month.
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
function my_pmpro_checkout_level($level) | |
{ | |
$current_day = date('j'); | |
$days_in_month = date('t'); | |
$level->initial_payment = $level->initial_payment*(($days_in_month - $current_day)/$days_in_month); | |
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