WC_Helper::has_product_subscription()public staticWC 3.7.0

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

Метод класса: WC_Helper{}

Хуков нет.

Возвращает

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

Использование

$result = WC_Helper::has_product_subscription( $product_id );
$product_id(int) (обязательный)
The product id.

Список изменений

С версии 3.7.0 Введена.

Код WC_Helper::has_product_subscription() 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 );
}