WC_Helper::has_product_subscription()public staticWC 3.7.0

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

{} It's a 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.

Code of WC_Helper::has_product_subscription() WC 6.7.0

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