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
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
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);
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);