WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Admin\API

MarketingOverview::activate_plugin() public WC 1.0

Return installed marketing extensions data.

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

No Hooks.

Return

\WP_Error|\WP_REST_Response.

Usage

$MarketingOverview = new MarketingOverview();
$MarketingOverview->activate_plugin( $request );
$request(\WP_REST_Request) (required)
Request data.

Code of MarketingOverview::activate_plugin() WC 6.1.1

public function activate_plugin( $request ) {
	$plugin_slug = $request->get_param( 'plugin' );

	if ( ! PluginsHelper::is_plugin_installed( $plugin_slug ) ) {
		return new \WP_Error( 'woocommerce_rest_invalid_plugin', __( 'Invalid plugin.', 'woocommerce' ), 404 );
	}

	$result = activate_plugin( PluginsHelper::get_plugin_path_from_slug( $plugin_slug ) );

	if ( ! is_null( $result ) ) {
		return new \WP_Error( 'woocommerce_rest_invalid_plugin', __( 'The plugin could not be activated.', 'woocommerce' ), 500 );
	}

	// IMPORTANT - Don't return the active plugins data here.
	// Instead we will get that data in a separate request to ensure they are loaded.
	return rest_ensure_response(
		array(
			'status' => 'success',
		)
	);
}