WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Admin\API

OnboardingProfile::get_email_prefill() public WC 1.0

Returns a default email to be pre-filled in OBW. Prioritizes Jetpack if connected, otherwise will default to WordPress general settings.

{} It's a method of the class: OnboardingProfile{}

No Hooks.

Return

WP_Error|WP_REST_Response.

Usage

$OnboardingProfile = new OnboardingProfile();
$OnboardingProfile->get_email_prefill( $request );
$request(WP_REST_Request) (required)
Request data.

Code of OnboardingProfile::get_email_prefill() WC 6.1.1

public function get_email_prefill( $request ) {
	$result = array(
		'email' => '',
	);

	// Attempt to get email from Jetpack.
	if ( class_exists( Jetpack_Connection_Manager::class ) ) {
		$jetpack_connection_manager = new Jetpack_Connection_Manager();
		if ( $jetpack_connection_manager->is_active() ) {
			$jetpack_user = $jetpack_connection_manager->get_connected_user_data();

			$result['email'] = $jetpack_user['email'];
		}
	}

	// Attempt to get email from WordPress general settings.
	if ( empty( $result['email'] ) ) {
		$result['email'] = get_option( 'admin_email' );
	}

	return rest_ensure_response( $result );
}