Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get All WooCommerce Order Notes
* Get all approved WooCommerce order notes.
* @param int|string $order_id The order ID.
* @return array $notes The order notes, or an empty array if none.
function km_get_order_notes( $order_id ) {
remove_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ) );
$comments = get_comments( array(
'post_id' => $order_id,
'orderby' => 'comment_ID',
'order' => 'DESC',
'approve' => 'approve',
'type' => 'order_note',
) );
$notes = wp_list_pluck( $comments, 'comment_content' );
add_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ) );
return $notes;
Copy link


Your work is amazing. How can I show all the data - same with what we see on the right side of the Edit Order page?

When I simply use the class WC_Meta_Box_Order_Notes, it's showing as empty.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment