• Resolved andrealves

    (@andrealves)


    Hi.

    The plugin is working great but I need to send an Hipay (gateway) transaction number to my file. The problem is that it’s not a metafield, it only writes the info on Order Notes: http://prntscr.com/tq0l5n

    Is there a way do sent this notes on the file as well? Or any other idea to accomplish this?

    Many thanks

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

    (@algolplus)

    hi

    please, follow to https://algolplus.freshdesk.com/support/solutions/articles/25000016635-add-calculated-field-for-order-

    add meta key “hipay_transaction” and use this PHP code.
    thanks, Alex

    add_filter('woe_get_order_value_hipay_transaction', function ($value,$order,$fieldname) {
        $args = array(
    		'post_id' 	=> $order->id,
    		'approve' 	=> 'approve',
    		'type' 		=> 'order_note',
    		'search'        => 'Hipay transaction',
        );
        // 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;
            if( preg_match("#Hipay transaction: (.+)#",$value,$match)) $value = $match[1];
        }
        return $value;
    },10, 3);
Viewing 1 replies (of 1 total)
  • The topic ‘Export Order Notes as well’ is closed to new replies.