Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

WC_Helper::_get_subscriptions_from_product_id( int $product_id, bool $single = true )

Get a subscription entry from product_id. If multiple subscriptions are found with the same product id and $single is set to true, will return the first one in the list, so you can use this method to get things like extension name, version, etc.


Description Description


Parameters Parameters

$product_id

(Required) The product id.

$single

(Optional) Whether to return a single subscription or all matching a product id.

Default value: true


Top ↑

Return Return

(array|bool) The array containing sub data or false.


Top ↑

Source Source

File: includes/admin/helper/class-wc-helper.php

	private static function _get_subscriptions_from_product_id( $product_id, $single = true ) {
		$subscriptions = wp_list_filter( self::get_subscriptions(), array( 'product_id' => $product_id ) );
		if ( ! empty( $subscriptions ) ) {
			return $single ? array_shift( $subscriptions ) : $subscriptions;
		}

		return false;
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.