WC_Product_Usage::get_product_usage_restriction_rule()private staticWC 9.3.0

Get the product usage rule for a product.

Method of the class: WC_Product_Usage{}

No Hooks.

Return

Array|null.

Usage

$result = WC_Product_Usage::get_product_usage_restriction_rule( $product_id ): ?array;
$product_id(int) (required)
product id to get feature restriction rules.

Changelog

Since 9.3.0 Introduced.

WC_Product_Usage::get_product_usage_restriction_rule() code WC 9.4.2

private static function get_product_usage_restriction_rule( int $product_id ): ?array {
	$rules = WC_Helper::get_product_usage_notice_rules();
	if ( empty( $rules['restricted_products'][ $product_id ] ) ) {
		return null;
	}

	return $rules['restricted_products'][ $product_id ];
}