shopp_product_addons()

retrieves a list of add-ons for the product.

shopp_product_addons ( $product, $load_by )

@param int $product the product id to get the addons for
@param string $load_by (optional) Default is 'id'. The product property to load against.
@return array of add-on Price objects, empty array if no addons, false on error

Description

Retrieves a list of add-ons for the product.

Examples

// Get all addons for product 130
$addons = shopp_product_addons ( 130 );

// create checkbox inputs for addons for product page
foreach ( $addons as $addon ) {
    echo '<input type="checkbox" name="products[130][addons][]" value="'. $addon->id .'" />\n';
}
// get addons for product with name 'My Product'
$addons = shopp_product_addons ( 'My Product', 'name' );
// get addons for product with slug 'my_product'
$addons = shopp_product_addons ( 'my_product', 'slug' );

See Also

You must be logged in to post a comment.

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

Skip to toolbar