wc_get_order_note()WC 3.2.0

Get an order note.

Хуки из функции

Возвращает

stdClass|null. Object with order note details or null when does not exists.

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

wc_get_order_note( $data );
$data(int|WP_Comment) (обязательный)
Note ID (or WP_Comment instance for internal use only).

Список изменений

С версии 3.2.0 Введена.

Код wc_get_order_note() WC 8.7.0

function wc_get_order_note( $data ) {
	if ( is_numeric( $data ) ) {
		$data = get_comment( $data );
	}

	if ( ! is_a( $data, 'WP_Comment' ) ) {
		return null;
	}

	return (object) apply_filters(
		'woocommerce_get_order_note',
		array(
			'id'            => (int) $data->comment_ID,
			'date_created'  => wc_string_to_datetime( $data->comment_date ),
			'content'       => $data->comment_content,
			'customer_note' => (bool) get_comment_meta( $data->comment_ID, 'is_customer_note', true ),
			'added_by'      => __( 'WooCommerce', 'woocommerce' ) === $data->comment_author ? 'system' : $data->comment_author,
		),
		$data
	);
}