Automattic\WooCommerce\Admin\Features\OnboardingTasks

TaskLists::setup_tasks_remaining()public staticWC 1.0

Return number of setup tasks remaining

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

No Hooks.

Return

number.

Usage

$result = TaskLists::setup_tasks_remaining ();

Code of TaskLists::setup_tasks_remaining() WC 6.6.1

public static function setup_tasks_remaining () {

	$active_list = self::is_experiment_treatment( 'woocommerce_tasklist_setup_experiment_1' ) ? 'setup_experiment_1' : ( self::is_experiment_treatment( 'woocommerce_tasklist_setup_experiment_2' ) ? 'setup_experiment_2' : 'setup' );

	$setup_list = self::get_list( $active_list );

	if( ! $setup_list || $setup_list->is_hidden() || $setup_list->is_complete() ) {
		return;
	}

	$remaining_tasks = array_values(
		array_filter(
			$setup_list->get_viewable_tasks(),
			function( $task ) {
				return ! $task->is_complete();
			}
		)
	);

	return count( $remaining_tasks );
}