Automattic\WooCommerce\Internal\Admin

CustomerEffortScoreTracks::enqueue_to_ces_tracks()privateWC 1.0

Enqueue the item to the CES tracks queue.

Метод класса: CustomerEffortScoreTracks{}

No Hooks.

Return

null. Nothing.

Usage

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

Code of CustomerEffortScoreTracks::enqueue_to_ces_tracks() WC 7.1.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
	);
}