Automattic\WooCommerce\Internal\ProductFeed\Storage

JsonFileFeed::add_entrypublicWC 1.0

Add an entry to the feed.

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

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$JsonFileFeed = new JsonFileFeed();
$JsonFileFeed->add_entry( $entry ): void;
$entry(массив) (обязательный)
The entry to add.

Код JsonFileFeed::add_entry() WC 10.5.2

public function add_entry( array $entry ): void {
	if ( ! is_resource( $this->file_handle ) ) {
		return;
	}

	if ( ! $this->has_entries ) {
		$this->has_entries = true;
	} else {
		fwrite( $this->file_handle, ',' );
	}

	$json = wp_json_encode( $entry );
	if ( false !== $json ) {
		fwrite( $this->file_handle, $json );
	}
}