WC_Product::set_category_ids()
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() WC Product::set category ids code WC 9.7.1
public function set_category_ids( $term_ids ) { $this->set_prop( 'category_ids', array_unique( array_map( 'intval', $term_ids ) ) ); }