WC_Helper::has_product_subscription()public staticWC 3.7.0

Checks whether current site has product subscription of a given ID.

Method of the class: WC_Helper{}

No Hooks.

Return

true|false. Returns true if product subscription exists, false otherwise.

Usage

$result = WC_Helper::has_product_subscription( $product_id );
$product_id(int) (required)
The product id.

Changelog

Since 3.7.0 Introduced.

WC_Helper::has_product_subscription() code WC 8.7.0

public static function has_product_subscription( $product_id ) {
	$subscription = self::_get_subscriptions_from_product_id( $product_id, true );
	return ! empty( $subscription );
}