Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello there.

    Order notes uses WordPress comment system. Below is how order notes are displayed.

    $args = array(
    	'post_id'   => $post->ID,
    	'orderby'   => 'comment_ID',
    	'order'     => 'DESC',
    	'approve'   => 'approve',
    	'type'      => 'order_note'
    );
    
    $notes = get_comments( $args );

    For complete reference see here.

    I’ve never build such this functionality before, but my intuition said that we can insert new order notes via wp_insert_comment or using woocommerce_new_order_note_data filter.

    I hope it helps.

    Thread Starter debone

    (@debone)

    Hmm.. I need to send the notes created, not create new ones 🙂
    But I figured out a way to make it work with the woocommerce_new_order_note_data you indicated

    Reference code

    add_filter( 'woocommerce_new_order_note_data', 'sendOrderNotes' );
    
    function sendOrderNotes( $order_note ) {
      //Use order notes here
      return $order_note;
    }

    Thanks for the help 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Order notes Hook for Webhook’ is closed to new replies.