Automattic\WooCommerce\Internal\Admin

WcPayWelcomePage::is_user_in_treatment_mode()privateWC 1.0

Checks if user is in the experiment.

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

No Hooks.

Return

true|false. Whether the user is in the treatment group.

Usage

// private - for code of main (parent) class only
$result = $this->is_user_in_treatment_mode();

Code of WcPayWelcomePage::is_user_in_treatment_mode() WC 7.1.0

private function is_user_in_treatment_mode() {
	$anon_id        = isset( $_COOKIE['tk_ai'] ) ? sanitize_text_field( wp_unslash( $_COOKIE['tk_ai'] ) ) : '';
	$allow_tracking = get_option( 'woocommerce_allow_tracking' ) === 'yes';
	$abtest         = new \WooCommerce\Admin\Experimental_Abtest(
		$anon_id,
		'woocommerce',
		$allow_tracking
	);

	return $abtest->get_variation( self::EXPERIMENT_NAME ) === 'treatment';
}