• Resolved tcdigital

    (@tcdigital)


    Is there a way to get the Paypal transaction id as an exportable value, e.g. as custom field?

    I’m trying to create an order export via the plugin “Advanced Order Export For WooCommerce” and I can’t seem to find a way to include the transaction id.

    Is the id retrievable in any way?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Andreas W.

    (@aweissinpsyde)

    Hello @tcdigital

    the transaction ID should be visible in the order notes.

    Best regards
    Andreas

    Thread Starter tcdigital

    (@tcdigital)

    I managed to extract the id from the order notes.

    The code is specific to “Advanced Order Export For WooCommerce” but could easily be adapted for other use cases. This one goes into the child theme functions.php

    Maybe this code helps someone with the same issue in the future.

    // Modify order notes for transaction id export
    add_filter('woe_get_order_value_order_notes',function ($value, $order,$fieldname) {
    	global $wpdb;
    
    	$table_prefixed = $wpdb->prefix . 'comments';
        $results = $wpdb->get_results("SELECT * FROM $table_prefixed WHERE comment_post_ID = {$order->id} AND comment_type LIKE 'order_note'");
    	
        $value = "";
    	
    	$paypal_plus_string = "PayPal PLUS-Zahlung genehmigt! Transaktions-ID: ";
    
        foreach($results as $note){
    		if (strpos($note->comment_content, $paypal_plus_string) !== false) {
    			$value .= str_replace($paypal_plus_string, "", $note->comment_content);	
    		}
        }
    	
        return $value;
    },10,3);
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Getting transaction id for export’ is closed to new replies.