shopp_product_set_subscription()

sets the subscription settings for a product of type Subcription.

shopp_product_set_subscription ( $product, $settings)

@param int $product (required) The Product id to set subscription settings on.
@param array $settings (required) The array of settings. Specify any trial period pricing, and the define the billing cycle.
@return bool/Price false on failure, true if Price saved, else the modified Price object.

Description

This function sets the subscription settings for a product of type Subcription. This call will not work for products with variations.

shopp_product_set_subscription() calls .

Examples

// subscription settings array
$settings = array();

// setup the trial period and price (optional)
$settings['trial'] = array();
$settings['trial']['price'] = 0.00;

// setup the trial cycle
$settings['trial']['price']['cycle'] = array();
// 7 day trial
$settings['trial']['price']['cycle']['interval'] = 7;
$settings['trial']['price']['cycle']['period'] = 'd';

// setup the billing cycle
$settings['billcycle'] = array();
// 0 for infinite cycles, integer number for # of cycles to repeat
$settings['billcycle']['cycles'] = 0;
$settings['billcycle']['cycle'] = array();
// repeat the billing cycles ever 12 months
// d for days, w or weeks, m for months, and y for years
$settings['billcycle']['cycle']['interval'] = 12;
$settings['billcycle']['cycle']['period'] = 'm';

// my subscription product with no variants
$product = 52;
shopp_product_set_subscription ( $product, $settings);

See Also

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar