Automattic\WooCommerce\Internal\Admin\Onboarding

OnboardingProducts::get_allowed_product_types()public staticWC 1.0

Get a list of allowed product types for the onboarding wizard.

Method of the class: OnboardingProducts{}

Return

Array.

Usage

$result = OnboardingProducts::get_allowed_product_types();

OnboardingProducts::get_allowed_product_types() code WC 8.6.1

public static function get_allowed_product_types() {
	$products         = array(
		'physical'        => array(
			'label'   => __( 'Physical products', 'woocommerce' ),
			'default' => true,
		),
		'downloads'       => array(
			'label' => __( 'Downloads', 'woocommerce' ),
		),
		'subscriptions'   => array(
			'label' => __( 'Subscriptions', 'woocommerce' ),
		),
		'memberships'     => array(
			'label'   => __( 'Memberships', 'woocommerce' ),
			'product' => 958589,
		),
		'bookings'        => array(
			'label'   => __( 'Bookings', 'woocommerce' ),
			'product' => 390890,
		),
		'product-bundles' => array(
			'label'   => __( 'Bundles', 'woocommerce' ),
			'product' => 18716,
		),
		'product-add-ons' => array(
			'label'   => __( 'Customizable products', 'woocommerce' ),
			'product' => 18618,
		),
	);
	$base_location    = wc_get_base_location();
	$has_cbd_industry = false;
	if ( 'US' === $base_location['country'] ) {
		$profile = get_option( OnboardingProfile::DATA_OPTION, array() );
		if ( ! empty( $profile['industry'] ) ) {
			$has_cbd_industry = in_array( 'cbd-other-hemp-derived-products', array_column( $profile['industry'], 'slug' ), true );
		}
	}
	if ( ! Features::is_enabled( 'subscriptions' ) || 'US' !== $base_location['country'] || $has_cbd_industry ) {
		$products['subscriptions']['product'] = 27147;
	}

	return apply_filters( 'woocommerce_admin_onboarding_product_types', $products );
}