Automattic\WooCommerce\Admin\API

OnboardingTasks::is_experiment_product_task()public staticWC 1.0

Check if product task experiment is treatment.

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

No Hooks.

Return

true|false.

Usage

$result = OnboardingTasks::is_experiment_product_task();

Code of OnboardingTasks::is_experiment_product_task() WC 6.6.1

public static function is_experiment_product_task() {
	$anon_id        = isset( $_COOKIE['tk_ai'] ) ? sanitize_text_field( wp_unslash( $_COOKIE['tk_ai'] ) ) : '';
	$allow_tracking = 'yes' === get_option( 'woocommerce_allow_tracking' );
	$abtest         = new \WooCommerce\Admin\Experimental_Abtest(
		$anon_id,
		'woocommerce',
		$allow_tracking
	);
	return $abtest->get_variation( 'woocommerce_products_task_layout_stacked' ) === 'treatment' ||
		$abtest->get_variation( 'woocommerce_products_task_layout_card' ) === 'treatment';
}