Skip to content

Instantly share code, notes, and snippets.

@messica
Last active December 2, 2020 15:55
Show Gist options
  • Save messica/810fbde865a6fa90c90b to your computer and use it in GitHub Desktop.
Save messica/810fbde865a6fa90c90b to your computer and use it in GitHub Desktop.
PMPro Gift Levels Example
<?php
/* PMPro Gift Levels Example */
global $pmprogl_gift_levels;
$pmprogl_gift_levels = array(
// Set level 1 as a "Purchase Gift" membership level to create a gift code for a free level 2 gift.
1 => array( // "Purchase Gift" level ID
'level_id' => 2, // Membership Level ID of the gift membership level.
'initial_payment' => 0, // The initial payment for the gift membership level.
'billing_amount' => 0, // The recurring billing amount for the gift membership level.The recurring billing amount for the gift membership level.
'cycle_number' => 0, // The number of billing cycles for the gift membership level.
'cycle_period' => '', // The billing cycle period. Possible values are "Day", "Week", "Month", and "Year" (without the quotes).
'billing_limit' => 0, // The billing cycle limit for the gift membership level.
'trial_amount' => 0, // The trial amount for the gift membership level.
'trial_limit' => 0, // The number of cycles the trial should last for the gift membership level.
'expiration_number' => 0, // The number of "experiation_period"s before the gift membership level expires.
'expiration_period' => '' // The duration of the period used by "expiration_number". Possible values are "Day", "Week", "Month", and "Year" (without the quotes).
),
// Also, set level 3 as a "Purchase Gift" membership level to create a customized level 4 gift.
3 => array(
'level_id' => 4, // Create a gift code for level 4
'initial_payment' => 10, // with an initial payment of $10.00
'billing_amount' => 10, // and a recurring billing amount of $10.00
'cycle_number' => 1, // every 1
'cycle_period' => 'Month', // months
'billing_limit' => 12, // for 12 months.
'trial_amount' => 0, // Add a free ($0.00) trial for
'trial_limit' => 1, // 1 subscription payment (1 months).
'expiration_number' => 1, // This level expires in 1
'expiration_period' => 'Year' // year.
)
);
// Make levels 2 and 4 require a discount code at checkout.
$pmprogl_require_gift_code = array(2,4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment