Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Custom PMPro Subscription Delay. If past the cutoff day, charge them the next payment day. So if 8th is the cutoff, and today is 9th, it will charge them the 9th of next month.
- */
- function my_pmprosd_modify_start_date($start_date, $order, $subscription_delay)
- {
- $cutoff = 8;
- $day_number = date('j');
- $month_number = date('m') ;
- $year_number = date('Y');
- if($cutoff < $day_number)
- {
- if($month_number == 12)
- {
- $month_number = 1;
- $year_number = $year_number + 1;
- }
- else
- $month_number = $month_number + 1;
- //charge them the 8th of next month?
- $start_date = date("Y-m-d", strtotime($year_number.'-'.$month_number.'-08'));
- }
- else
- {
- $start_date = date("Y-m-d", strtotime($year_number.'-'.$month_number.'-08'));
- }
- return $start_date;
- }
- add_filter('pmprosd_modify_start_date', 'my_pmprosd_modify_start_date', 10, 3);
Add Comment
Please, Sign In to add comment