Gravity Forms is by far my favorite forms plugin for WordPress – with all the great extensions, like PayPal and Mailchimp, and the ease of use for clients.
So, if you’re using Gravity Forms (aff) in conjunction with the PayPal Addon to get donations or to sell individual products, you may need to send the PayPal Transaction ID to your customer or keep it for your own records.
Here’s how:
In your functions.php add the following:
1 2 3 4 5 6 |
add_filter( 'gform_replace_merge_tags', 'replace_transaction_id', 10, 7 ); function replace_transaction_id( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format ) { $transaction_id = empty( $transaction_id ) ? rgar( $entry, 'transaction_id' ) : $transaction_id; $text = str_replace( '{transaction_id}', $transaction_id, $text ); return $text; } |
In the Notifications (Under Form Settings > Notifications), use the merge tag {transaction_id}.
That’s it!