WC_Product::set_category_ids()publicWC 3.0.0

Set the product categories.

Method of the class: WC_Product{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Product = new WC_Product();
$WC_Product->set_category_ids( $term_ids );
$term_ids(array) (required)
List of terms IDs.

Changelog

Since 3.0.0 Introduced.

WC_Product::set_category_ids() code WC 8.7.0

public function set_category_ids( $term_ids ) {
	$this->set_prop( 'category_ids', array_unique( array_map( 'intval', $term_ids ) ) );
}