retrieves a list of variant Price objects for a product.

shopp_product_variants ( $product )

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


Retrieves a list of variants for the product.


// variants of product with id 121
$variants = shopp_product_variants(121);

// get the max price of all the variants
$max_price = 0;
foreach ( $variants as $variant ) {
    $max_price = max( $max_price, $variant->price );
// variants for product by name
$variants = shopp_product_variants('My Product', 'name');
// variants for product by slug
$variants = shopp_product_variants('my_product', 'slug');

See Also

You must be logged in to post a comment.

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