WC_Helper::get_unconnected_subscriptions()public staticWC 1.0

Get the user's unconnected subscriptions.

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

Хуков нет.

Возвращает

Массив.

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

$result = WC_Helper::get_unconnected_subscriptions();

Код WC_Helper::get_unconnected_subscriptions() WC 9.4.2

public static function get_unconnected_subscriptions() {
	static $unconnected_subscriptions = null;

	// Cache unconnected_subscriptions in the current request.
	if ( is_null( $unconnected_subscriptions ) ) {
		$auth    = WC_Helper_Options::get( 'auth' );
		$site_id = isset( $auth['site_id'] ) ? absint( $auth['site_id'] ) : 0;
		if ( 0 === $site_id ) {
			$unconnected_subscriptions = array();
			return $unconnected_subscriptions;
		}

		$unconnected_subscriptions = array_filter(
			self::get_subscriptions(),
			function ( $subscription ) use ( $site_id ) {
				return empty( $subscription['connections'] );
			}
		);
	}

	return $unconnected_subscriptions;
}