Automattic\WooCommerce\Admin\Features\OnboardingTasks

TaskList::possibly_track_completion()publicWC 1.0

Track list completion of viewable tasks.

Method of the class: TaskList{}

No Hooks.

Return

null. Nothing (null).

Usage

$TaskList = new TaskList();
$TaskList->possibly_track_completion();

TaskList::possibly_track_completion() code WC 9.0.1

public function possibly_track_completion() {
	if ( $this->has_previously_completed() ) {
		return;
	}

	// If it's hidden, completion is tracked via hide method.
	if ( $this->is_hidden() ) {
		return;
	}

	// Expensive check, do it last.
	if ( ! $this->is_complete() ) {
		return;
	}

	$completed_lists   = get_option( self::COMPLETED_OPTION, array() );
	$completed_lists[] = $this->get_list_id();
	update_option( self::COMPLETED_OPTION, $completed_lists );
	$this->maybe_set_default_layout( $completed_lists );
	$this->record_tracks_event(
		'tasks_completed',
		array(
			'tasklist_id' => $this->id,
		)
	);
}