Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of using the 'discount_code' attribute to change expiration date for PMPro Sponsored Members
Override the discount code given to sponsored members.
This recipe makes any sponsored members with level 2 expire in 2 days.
The 'discount_code' array supports the following attributes:
code_id, level_id, initial_payment, billing_amount, cycle_number, cycle_period, billing_limit,
trial_amount, trial_limit, expiration_number, expiration_period
Make sure that strings in the _period values are wrapped in single quotes, e.g. 'expiration_period' => "'Year'"
global $pmprosm_sponsored_account_levels;
$pmprosm_sponsored_account_levels = array(
//set 5 seats at checkout
1 => array(
'main_level_id' => 1, //redundant but useful
'sponsored_level_id' => 2, //array or single id
'seats' => 200,
'seat_cost' => 0,
'discount_code' => array(
'expiration_number' => '2',
'expiration_period' => "'Day'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment