WordPress at a glance
function is not described

Automattic\WooCommerce\Admin\API

OnboardingThemes::activate_theme() public WC 1.0

Activate the requested theme.

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

No Hooks.

Return

WP_Error|Array. Theme activation status.

Usage

$OnboardingThemes = new OnboardingThemes();
$OnboardingThemes->activate_theme( $request );
$request(WP_REST_Request) (required)
Full details about the request.

Code of OnboardingThemes::activate_theme() WC 5.3.0

<?php
public function activate_theme( $request ) {
	$allowed_themes = Onboarding::get_allowed_themes();
	$theme          = sanitize_text_field( $request['theme'] );
	if ( ! in_array( $theme, $allowed_themes, true ) ) {
		return new \WP_Error( 'woocommerce_rest_invalid_theme', __( 'Invalid theme.', 'woocommerce' ), 404 );
	}

	require_once ABSPATH . 'wp-admin/includes/theme.php';

	$installed_themes = wp_get_themes();

	if ( ! in_array( $theme, array_keys( $installed_themes ), true ) ) {
		/* translators: %s: theme slug (example: woocommerce-services) */
		return new \WP_Error( 'woocommerce_rest_invalid_theme', sprintf( __( 'Invalid theme %s.', 'woocommerce' ), $theme ), 404 );
	}

	$result = switch_theme( $theme );
	if ( ! is_null( $result ) ) {
		return new \WP_Error( 'woocommerce_rest_invalid_theme', sprintf( __( 'The requested theme could not be activated.', 'woocommerce' ), $theme ), 500 );
	}

	return( array(
		'slug'   => $theme,
		'name'   => $installed_themes[ $theme ]->get( 'Name' ),
		'status' => 'success',
	) );
}