WooCommerce\Admin

Experimental_Abtest::in_treatment()public staticWC 1.0

Returns true if the current user is in the treatment group of the given experiment.

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

Хуков нет.

Возвращает

true|false.

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

$result = Experimental_Abtest::in_treatment( $experiment_name, $as_auth_wpcom_user );
$experiment_name(строка) (обязательный)
Name of the experiment.
$as_auth_wpcom_user(true|false)
Request variation as a auth wp user or not.
По умолчанию: false

Код Experimental_Abtest::in_treatment() WC 6.9.4

public static function in_treatment( string $experiment_name, bool $as_auth_wpcom_user = false ) {
	$anon_id        = isset( $_COOKIE['tk_ai'] ) ? sanitize_text_field( wp_unslash( $_COOKIE['tk_ai'] ) ) : '';
	$allow_tracking = 'yes' === get_option( 'woocommerce_allow_tracking' );
	$abtest         = new self(
		$anon_id,
		'woocommerce',
		$allow_tracking,
		$as_auth_wpcom_user
	);

	return $abtest->get_variation( $experiment_name ) === 'treatment';
}