Automattic\WooCommerce\Internal\ProductFeed\Storage
JsonFileFeed::add_entry
Add an entry to the feed.
Method of the class: JsonFileFeed{}
No Hooks.
Returns
null. Nothing (null).
Usage
$JsonFileFeed = new JsonFileFeed(); $JsonFileFeed->add_entry( $entry ): void;
- $entry(array) (required)
- The entry to add.
JsonFileFeed::add_entry() JsonFileFeed::add entry code WC 10.8.1
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 );
}
}