add a product category

shopp_add_product_category ( $name, $description, $parent )

@param string $name (required) The category name.
@param string $description (optional) The category description.
@param int $parent (optional) Parent category id.
@return bool|int false on error, int category id on success.


add a product category

When called, a WordPress term of taxonomy type shopp_category is created.


// create a top level product category
$cat_id = shopp_add_product_category('My New Product Category', 'A category of products.');

// create a product sub-category
$sub_cat_id = shopp_add_product_category('My New Child Product Category', 'A sub-category of products.', $cat_id);

// add a product to the product categories
$product = 5; // product id 5
shopp_product_add_categories($product, array($cat_id, $sub_cat_id));

See Also

You must be logged in to post a comment.

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