Forked from greathmaster/pmpro-prorate-initial-payment.php
Created
May 20, 2020 13:35
-
-
Save MaryOJob/f36cf71e113675af799195a4a1f9aec0 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 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