WC_Coupon::set_product_categories()publicWC 3.0.0

Set the product category IDs this coupon can be used with.

Method of the class: WC_Coupon{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Coupon = new WC_Coupon();
$WC_Coupon->set_product_categories( $product_categories );
$product_categories(array) (required)
List of product categories.

Changelog

Since 3.0.0 Introduced.

WC_Coupon::set_product_categories() code WC 9.4.2

public function set_product_categories( $product_categories ) {
	$this->set_prop( 'product_categories', array_filter( wp_parse_id_list( (array) $product_categories ) ) );
}