Automattic\WooCommerce\Internal\Admin

CustomerEffortScoreTracks::enqueue_to_ces_tracks()privateWC 1.0

Enqueue the item to the CES tracks queue.

Method of the class: CustomerEffortScoreTracks{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->enqueue_to_ces_tracks( $item );
$item(array) (required)
The item to enqueue.

CustomerEffortScoreTracks::enqueue_to_ces_tracks() code WC 8.7.0

private function enqueue_to_ces_tracks( $item ) {
	$queue = get_option(
		self::CES_TRACKS_QUEUE_OPTION_NAME,
		array()
	);

	$has_duplicate = array_filter(
		$queue,
		function ( $queue_item ) use ( $item ) {
			return $queue_item['action'] === $item['action'];
		}
	);
	if ( $has_duplicate ) {
		return;
	}

	$queue[] = $item;

	update_option(
		self::CES_TRACKS_QUEUE_OPTION_NAME,
		$queue
	);
}