Hello @tcdigital
the transaction ID should be visible in the order notes.
Best regards
Andreas
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);