• Resolved jeffatrmc

    (@jeffatrmc)


    Hi There,

    Is there any way to export the order notes? I have looked through all of the options and don’t see any option to export the notes included in WooCommerce orders. I am open to a php solution if need be.

    Best,
    Jeff

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author algol.plus

    (@algolplus)

    hi Jeff

    Please, open section “Setup Fields” and drag field “Order Notes” or “Customer Note”.

    if you see only GREEN fields — turn off “Summary by products” mode.

    thanks, Alex

    Thread Starter jeffatrmc

    (@jeffatrmc)

    Hi @algolplus

    This is great. Is there any way to have individual order notes separated by “/”? Right now it pushes them together so it is hard to tell where one order note begins and where another ends.

    Also, it puts all of the order notes in one section which will be covered up by other columns. Is there any way to have it create another row when the order notes section is too long?

    Let me know what is possible.

    Best,
    Jeff

    Plugin Author algol.plus

    (@algolplus)

    hi Jeff

    open section “Misc Settings” and add this PHP code.
    thanks , Alex

    add_filter('woe_get_order_value_order_notes',function ($value, $order,$fieldname) {
    	return preg_replace( "/\r|\n/", "/", $value);
    },10,3);
    Plugin Author algol.plus

    (@algolplus)

    I think ti’s possible to add each note as separate row.
    But you should be PHP programmer.

    please, check this page https://docs.algolplus.com/algol_order_export/add-product-rows/

    Thread Starter jeffatrmc

    (@jeffatrmc)

    Hi @algolplus

    This brings me to a follow up question. Is there any way to only export the most recent order note through misc settings? I tried unchecking export all order notes but it didn’t seem to change anything.

    Best,
    Jeff

    Plugin Author algol.plus

    (@algolplus)

    You should replace previous code with this version

    add_filter('woe_get_order_value_order_notes',function ($value, $order,$fieldname) {
      $records = explode("\n",$value);
      return reset($records);
    },10,3);
    Thread Starter jeffatrmc

    (@jeffatrmc)

    Hi @algolplus

    This is another great step. However, I now see that it is counting an “enter key” within a single order note as the beginning of a new note.

    For instance when you send a note to a customer and start off with:
    “Hello John,

    Your order has been…”

    It thinks Hello John, is its own separate note instead of just the beginning of the complete note. Is there any way to adjust this so it doesn’t read an enter as a new note?

    Best,
    Jeff

    Plugin Author algol.plus

    (@algolplus)

    ok, I got it.
    but it’s more complex

    add_filter('woe_get_order_value_order_notes',function ($value, $order,$fieldname) {
       $args = array(
    		'post_id' 	=> $order->id,
    		'approve' 	=> 'approve',
    		'type' 		=> 'order_note',
    		'search'        => '',
        );
        // woocommerce hides such records by default
        remove_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ), 10 );
        $notes = get_comments( $args );
        add_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ), 10, 1 );
    
        $value = '';
        if(!empty($notes)) {
            $value = $notes[0]->comment_content;
        }
        return $value;
    },10,3);
    Thread Starter jeffatrmc

    (@jeffatrmc)

    Hi @algolplus

    This is amazing! Thank you a ton for helping me with this!

    Best,
    Jeff

    Plugin Author algol.plus

    (@algolplus)

    you’re very welcome

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Order Notes’ is closed to new replies.