Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save JarrydLong/d6b89d5ea48e54d9d77637d19add2c9a to your computer and use it in GitHub Desktop.

Select an option

Save JarrydLong/d6b89d5ea48e54d9d77637d19add2c9a to your computer and use it in GitHub Desktop.
PMPro Adjust start date to the first following Sunday.
<?php //do not copy
/*
Adjust start date to the first following Sunday for a specific level
*/
function my_pmpro_checkout_start_date( $startdate, $user_id, $level ){
if( $level->id == 8 ) { //Change to the preferred level you want this to apply to
//which day is it
$checkout_day = date("N");
//days to sunday
$days_to_sunday = 7 - $checkout_day;
//add the days
$startdate = date("Y-m-d", strtotime("+ " . $days_to_sunday . " days"));
}
return $startdate;
}
add_filter( 'pmpro_checkout_start_date', 'my_pmpro_checkout_start_date', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment