Automattic\WooCommerce\Admin\API

OnboardingProfile::get_items()publicWC 1.0

Return all onboarding profile data.

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

Хуков нет.

Возвращает

WP_Error|WP_REST_Response.

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

$OnboardingProfile = new OnboardingProfile();
$OnboardingProfile->get_items( $request );
$request(WP_REST_Request) (обязательный)
Request data.

Код OnboardingProfile::get_items() WC 8.7.0

public function get_items( $request ) {
	include_once WC_ABSPATH . 'includes/admin/helper/class-wc-helper-options.php';

	$onboarding_data             = get_option( Profile::DATA_OPTION, array() );
	$onboarding_data['industry'] = isset( $onboarding_data['industry'] ) ? $this->filter_industries( $onboarding_data['industry'] ) : null;
	$item_schema                 = $this->get_item_schema();
	$items                       = array();
	foreach ( $item_schema['properties'] as $key => $property_schema ) {
		$items[ $key ] = isset( $onboarding_data[ $key ] ) ? $onboarding_data[ $key ] : null;
	}

	$wccom_auth               = \WC_Helper_Options::get( 'auth' );
	$items['wccom_connected'] = empty( $wccom_auth['access_token'] ) ? false : true;

	$item = $this->prepare_item_for_response( $items, $request );
	$data = $this->prepare_response_for_collection( $item );

	return rest_ensure_response( $data );
}