Skip to content

Instantly share code, notes, and snippets.

@greathmaster
Created December 22, 2015 17:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save greathmaster/d1fa4b67f6d5218ff1fa to your computer and use it in GitHub Desktop.
Save greathmaster/d1fa4b67f6d5218ff1fa to your computer and use it in GitHub Desktop.
Prorate the initial payment. Useful for subscriptions that occur on the first of every month.
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