WooCommerce\Admin

Experimental_Abtest::in_treatment_handled_exception()public staticWC 1.0

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

If an exception occurs, it will be handled and false will be returned.

Method of the class: Experimental_Abtest{}

No Hooks.

Return

true|false. True if the user is in the treatment group, false otherwise (including if an exception is thrown).

Usage

$result = Experimental_Abtest::in_treatment_handled_exception( $experiment_name, $as_auth_wpcom_user );
$experiment_name(string) (required)
Name of the experiment.
$as_auth_wpcom_user(true|false)
Request variation as an auth wp user or not.
Default: false

Experimental_Abtest::in_treatment_handled_exception() code WC 9.7.1

public static function in_treatment_handled_exception( string $experiment_name, bool $as_auth_wpcom_user = false ) {
	try {
		return self::in_treatment( $experiment_name, $as_auth_wpcom_user );
	} catch ( \Exception $e ) {
		return false;
	}
}