Automattic\WooCommerce\Admin\API

Notes::update_item()publicWC 1.0

Update a single note.

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

Хуков нет.

Возвращает

WP_REST_Request|WP_Error.

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

$Notes = new Notes();
$Notes->update_item( $request );
$request(WP_REST_Request) (обязательный)
Full details about the request.

Код Notes::update_item() WC 9.3.1

public function update_item( $request ) {
	$note = NotesRepository::get_note( $request->get_param( 'id' ) );

	if ( ! $note ) {
		return new \WP_Error(
			'woocommerce_note_invalid_id',
			__( 'Sorry, there is no resource with that ID.', 'woocommerce' ),
			array( 'status' => 404 )
		);
	}

	NotesRepository::update_note( $note, $this->get_requested_updates( $request ) );
	return $this->get_item( $request );
}