WC_Helper::get_installed_subscriptions()
Get the user's connected subscriptions that are installed on the current site.
Method of the class: WC_Helper{}
No Hooks.
Return
Array
.
Usage
$result = WC_Helper::get_installed_subscriptions();
WC_Helper::get_installed_subscriptions() WC Helper::get installed subscriptions code WC 9.2.3
public static function get_installed_subscriptions() { static $installed_subscriptions = null; // Cache installed_subscriptions in the current request. if ( is_null( $installed_subscriptions ) ) { $auth = WC_Helper_Options::get( 'auth' ); $site_id = isset( $auth['site_id'] ) ? absint( $auth['site_id'] ) : 0; if ( 0 === $site_id ) { $installed_subscriptions = array(); return $installed_subscriptions; } $installed_subscriptions = array_filter( self::get_subscriptions(), function ( $subscription ) use ( $site_id ) { return in_array( $site_id, $subscription['connections'], true ); } ); } return $installed_subscriptions; }