• Order notes is set up as a field but when I add it to my export, it does not return any data

    I want to see all the order notes that appear in the order notes box in a woocommerce order
    – changes in stock
    – payment notes

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter goodlocalej

    (@goodlocalej)

    I found the export all order notes option.

    Is there a way I can filter results by order note

    I am looking to only export orders where order note = The card’s security code is incorrect

    Plugin Author algol.plus

    (@algolplus)

    Hello

    1. You have to add new field using this way
    https://docs.algolplus.com/algol_order_export/fields/

    2. check “date_processed” example to see how to work with order notes
    https://docs.algolplus.com/algol_order_export/add-new-fields/

    thanks, Alex

    Thread Starter goodlocalej

    (@goodlocalej)

    hello alex.

    this helps. i can see the orders i want because they show date processing.

    how can i change my code to exclude orders that i do not want

    // add field “Date Processed”, based on order’s comments
    add_filter(‘woe_get_order_fields’, function ($fields) {
    $fields[‘date_processed’] = array( ‘label’ => ‘Date Processed’, ‘colname’ =>’Date Processed’, ‘segment’ => ‘common’, ‘format’=>’date’, ‘checked’ => 1 );
    return $fields;
    });
    add_filter(‘woe_get_order_value_date_processed’, function ($value,$order,$fieldname) {
    $args = array(
    ‘post_id’ => $order->id,
    ‘approve’ => ‘approve’,
    ‘type’ => ‘order_note’,
    ‘search’ => ‘security code is incorrect’,
    );
    // 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 );

    $date_processed = ”;
    if(!empty($notes)) {
    $date_processed = $notes[0]->comment_date;
    }
    return $date_processed;
    },10, 3);

    Plugin Author algol.plus

    (@algolplus)

    my bad, I misunderstand you.
    So please, IGNORE my previous replies!

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

    add_filter( 'woe_sql_get_order_ids_where', function($where, $settings ){
    global $wpdb;
    $where[] = " orders.ID IN (SELECT comment_post_ID FROM {$wpdb->comments} WHERE comment_content LIKE '%security code is incorrect%') ";
    return $where;
    },10,2);
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Export order notes returning blank data’ is closed to new replies.