WC_Order::get_customer_order_notes()publicWC 1.0

List order notes (public) for the customer.

Method of the class: WC_Order{}

No Hooks.

Return

Array.

Usage

$WC_Order = new WC_Order();
$WC_Order->get_customer_order_notes();

WC_Order::get_customer_order_notes() code WC 8.7.0

public function get_customer_order_notes() {
	$notes = array();
	$args  = array(
		'post_id' => $this->get_id(),
		'approve' => 'approve',
		'type'    => '',
	);

	remove_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ) );

	$comments = get_comments( $args );

	foreach ( $comments as $comment ) {
		if ( ! get_comment_meta( $comment->comment_ID, 'is_customer_note', true ) ) {
			continue;
		}
		$comment->comment_content = make_clickable( $comment->comment_content );
		$notes[]                  = $comment;
	}

	add_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ) );

	return $notes;
}