After some more digging around and reading the code, I managed to figure out how to do this. The transaction ID was in the $lead variable used in 'gform_replace_merge_tags'.
It was also returning null for me because I was running the site on the different port than port 80. Changed the site to port 80 and was able to print out the transaction ID with the following code. Thanks for getting me in the right direction Chris!
add_filter('gform_replace_merge_tags', 'replace_transaction_id', 10, 7);
function replace_transaction_id($text, $form, $lead, $url_encode, $esc_html, $nl2br, $format) {
$custom_merge_tag = '{txn_id}';
if(strpos($text, $custom_merge_tag) === false)
return $text;
$transaction_id = $lead["transaction_id"];
$text = str_replace($custom_merge_tag, $transaction_id, $text);
return $text;
}
Posted 11 years ago on Friday February 1, 2013 |
Permalink