WordPress at Your Fingertips
function is not described

WooCommerce\Admin

Experimental_Abtest::request_variation() protected WC 1.0

Perform the request for a variation of a provided A/B test from WP.com.

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

No Hooks.

Return

Array|\WP_Error. A/B test variation error on failure.

Usage

// protected - for code of main (parent) or child class
$result = $this->request_variation( $test_name );
$test_name(string) (required)
Name of the A/B test.

Code of Experimental_Abtest::request_variation() WC 6.1.0

protected function request_variation( $test_name ) {
	$args = array(
		'experiment_name'  => $test_name,
		'anon_id'          => rawurlencode( $this->anon_id ),
		'woo_country_code' => rawurlencode( get_option( 'woocommerce_default_country', 'US:CA' ) ),
	);

	$url = add_query_arg(
		$args,
		sprintf(
			'https://public-api.wordpress.com/wpcom/v2/experiments/0.1.0/assignments/%s',
			$this->platform
		)
	);

	$get = wp_remote_get( $url );

	return $get;
}