Automattic\WooCommerce\Internal\Admin\Onboarding

OnboardingProducts::get_relevant_products()public staticWC 1.0

Get relevant purchaseable products for the site.

{} Это метод класса: OnboardingProducts{}

Хуков нет.

Возвращает

Массив.

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

$result = OnboardingProducts::get_relevant_products();

Код OnboardingProducts::get_relevant_products() WC 6.6.1

public static function get_relevant_products() {
	$profiler_data = get_option( OnboardingProfile::DATA_OPTION, array() );
	$installed     = PluginsHelper::get_installed_plugin_slugs();
	$product_types = isset( $profiler_data['product_types'] ) ? $profiler_data['product_types'] : array();
	$product_data  = self::get_product_types_with_data();
	$purchaseable  = array();
	$remaining     = array();
	foreach ( $product_types as $type ) {
		if ( ! isset( $product_data[ $type ]['slug'] ) ) {
			continue;
		}

		$purchaseable[] = $product_data[ $type ];

		if ( ! in_array( $product_data[ $type ]['slug'], $installed, true ) ) {
			$remaining[] = $product_data[ $type ]['label'];
		}
	}

	return array(
		'purchaseable' => $purchaseable,
		'remaining'    => $remaining,
	);
}