WooCommerce\Admin

Experimental_Abtest::get_variation()publicWC 1.0

Retrieve the test variation for a provided A/B test.

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

Хуков нет.

Возвращает

Разное|null. A/B test variation, or null on failure.

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

$Experimental_Abtest = new Experimental_Abtest();
$Experimental_Abtest->get_variation( $test_name );
$test_name(строка) (обязательный)
Name of the A/B test.

Код Experimental_Abtest::get_variation() WC 7.1.0

public function get_variation( $test_name ) {
	// Default to the control variation when users haven't consented to tracking.
	if ( ! $this->consent ) {
		return 'control';
	}

	$variation = $this->fetch_variation( $test_name );

	// If there was an error retrieving a variation, conceal the error for the consumer.
	if ( is_wp_error( $variation ) ) {
		return 'control';
	}

	return $variation;
}