For the WooCommerce Moneybird plugin I recently needed to retrieve the customer order notes which a user can add during the checkout procedure. This seems simple: there is a function “get_customer_order_notes()”.  Strangely this function does not return the order notes at all. An empty array is returned. This function seems to look into the comments, while after some searching, the notes I added to a purchase were added as post excerpt to the order post type. No function seems to be available to retrieve this data. If it is, I haven’t found it!

So I wrote a very simple function to retrieve this excerpt:


function rsp_get_wc_order_notes( $order_id){
    //make sure it's a number
    $order_id = intval($order_id);
    //get the post 
    $post = get_post($order_id);
    //if there's no post, return as error
    if (!$post) return false;

    return $post->post_excerpt;

Leave a Reply

Your email address will not be published. Required fields are marked *