Created
March 18, 2014 17:44
-
-
Save strangerstudios/9625274 to your computer and use it in GitHub Desktop.
Add 2 week trial to a monthly subscription plan
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
//change the profile start date | |
function my_pmpro_profile_start_date($date, $order) | |
{ | |
if($order->membership_id == 1) | |
$date = date("Y-m-d", strtotime("+ 14 Days")) . "T0:0:0"; | |
return $date; | |
} | |
add_filter("pmpro_profile_start_date", "my_pmpro_profile_start_date", 10, 2); | |
//change the level cost text | |
function my_pmpro_level_cost_text($cost, $level) | |
{ | |
if($level->id == 1) | |
{ | |
$cost = str_replace("Month.", "Month", $cost); | |
$cost .= " after your <strong>2 week trial</strong>."; | |
} | |
return $cost; | |
} | |
add_filter("pmpro_level_cost_text", "my_pmpro_level_cost_text", 10, 2); | |
//remove any trial we might already have on the level (especially important for Authorize.net users since we add a trial to all levels) | |
function my_pmpro_subscribe_order($order, $gateway) | |
{ | |
//are we overriding the trial for this level? | |
if($order->membership_id == 1) | |
{ | |
//remove the trial we add to Authorize.net levels | |
$order->TrialBillingCycles = 0; | |
} | |
return $order; | |
} | |
add_filter("pmpro_subscribe_order", "my_pmpro_subscribe_order", 10, 2); | |
Update |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment