Title: Adding payment transaction id
Last modified: April 16, 2017

---

# Adding payment transaction id

 *  Resolved Anonymous User 12711743
 * (@anonymized-12711743)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/adding-payment-transaction-id/)
 * Hi,
 * can we add payment transaction id at the payment method row?
 * Ian

Viewing 11 replies - 1 through 11 (of 11 total)

 *  [seank123](https://wordpress.org/support/users/seank123/)
 * (@seank123)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/adding-payment-transaction-id/#post-9044495)
 * I am trying with this:
 *     ```
       <tr class="payment-method">
       <th><?php _e( 'Transaction ID:', 'wpo_wcpdf' ); ?></th>
         <td><?php $wpo_wcpdf->custom_field('Transaction ID'); ?><?php $wpo_wcpdf->custom_field('_transaction_id'); ?></td>
       </tr>
       ```
   
 * I have a Worldpay plugin installed and this shows the transaction ID.
 * But it doesn’t show the Paypal transaction ID at all!
 *  Thread Starter Anonymous User 12711743
 * (@anonymized-12711743)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/adding-payment-transaction-id/#post-9047427)
 * any solutions?
 *  Plugin Contributor [Ewout](https://wordpress.org/support/users/pomegranate/)
 * (@pomegranate)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/adding-payment-transaction-id/#post-9048784)
 * I don’t know where Worldpay stores the transaction ID, but woocommerce stores
   it as a property ‘transaction_id’ (it’s quite likely that Worldpay uses this 
   too, but not necessarily). You can show it in a custom template with:
 *     ```
       <?php echo $this->order->get_transaction_id(); ?>
       ```
   
 * Hope that helps!
    Ewout
 *  [seank123](https://wordpress.org/support/users/seank123/)
 * (@seank123)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/adding-payment-transaction-id/#post-9049372)
 * Thanks – that snippet shows the Paypal transaction ID but not the Worldpay one!
   
   The one in my original code shows Workdpay but not Paypal!
 * So, I’ve just combined them like this:
 *     ```
        				<tr class="payment-method">
       					<th><?php _e( 'Transaction ID:', 'wpo_wcpdf' ); ?></th>
       					<td><?php $wpo_wcpdf->custom_field('Transaction ID'); ?><?php $wpo_wcpdf->custom_field('_transaction_id'); ?><?php echo $this->order->get_transaction_id(); ?></td>
                       </tr>
       ```
   
 * So it shows both now – obviously only one will get displayed in the invoice, 
   but the other will return nothing so it effectively works!
 * Thanks for your help!
 *  Plugin Contributor [Ewout](https://wordpress.org/support/users/pomegranate/)
 * (@pomegranate)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/adding-payment-transaction-id/#post-9052539)
 * You’re welcome! You can leave out the `<?php $wpo_wcpdf->custom_field('_transaction_id');?
   >` bit, since that will not work because it’s a property that can only be called
   with the `get_transaction_id()` method.
 * If you can spare a moment, I’d appreciate a [plugin review](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/reviews/#new-post)–
   thanks in advance and have a fantastic weekend!
 * Ewout
 *  [seank123](https://wordpress.org/support/users/seank123/)
 * (@seank123)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/adding-payment-transaction-id/#post-9052733)
 * That first bit shows the transaction ID from the Worldpay plugin so I need it–
   but if you’re only using Paypal then, yes, it should be removed.Not sure how 
   other gateways would work though.
 * Sorry, thought I’d already left a review! Done it now.
 *  Plugin Contributor [Ewout](https://wordpress.org/support/users/pomegranate/)
 * (@pomegranate)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/adding-payment-transaction-id/#post-9052766)
 * No I meant the one in between (there’s three now). _transaction_id is a ‘custom
   field’ that is treated as a property in WC3.0. get_transaction_id() actually 
   gets this custom field, but through the new $order->get_meta() you cannot retrieve
   it anymore. sorry if this is confusing – as long as it works 🙂
 *  [seank123](https://wordpress.org/support/users/seank123/)
 * (@seank123)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/adding-payment-transaction-id/#post-9052830)
 * Oh right – forgot to delete that one!
 * I’ll keep an eye on it to make sure it carries on working!
 * Thanks for your help
 *  [dbosleyjr](https://wordpress.org/support/users/dbosleyjr/)
 * (@dbosleyjr)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/adding-payment-transaction-id/#post-9578455)
 * Where did you place this code? Trying to get it to work on my end.
 *  [dbosleyjr](https://wordpress.org/support/users/dbosleyjr/)
 * (@dbosleyjr)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/adding-payment-transaction-id/#post-9578488)
 * 1. I followed this per the plugin note: _Want to use your own template? Copy 
   all the files from wp-content/plugins/woocommerce-pdf-invoices-packing-slips/
   templates/Simple to your (child) theme in wp-content/themes/pro-child/woocommerce/
   pdf/yourtemplate to customize them_
 * and created a new template called SimpleNew
 * 2. I edited the invoice.php file
 * //replaced:
 * <tr class=”payment-method”>
    <th><?php _e( ‘Payment Method:’, ‘woocommerce-pdf-
   invoices-packing-slips’ ); ?></th> <td><?php $this->payment_method(); ?></td>
   </tr>
 * //with:
 * <tr class=”payment-method”>
    <th><?php _e( ‘Payment Method:’, ‘woocommerce-pdf-
   invoices-packing-slips’ ); ?></th> <td><?php $this->payment_method(); ?></td>
   <th><?php _e( ‘Transaction ID:’, ‘wpo_wcpdf’ ); ?></th> <td><?php $wpo_wcpdf-
   >custom_field(‘Transaction ID’); ?><?php echo $this->order->get_transaction_id();?
   ></td> </tr>
 * But it didn’t work!
 *  [dbosleyjr](https://wordpress.org/support/users/dbosleyjr/)
 * (@dbosleyjr)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/adding-payment-transaction-id/#post-9578514)
 * Solved it! I now have this which works for both CC and paypal transaction ID 
   and creates a separate line for just transaction ID.
 * <tr class=”payment-method”>
    <th><?php _e( ‘Payment Method:’, ‘woocommerce-pdf-
   invoices-packing-slips’ ); ?></th> <td><?php $this->payment_method(); ?></td>
   </tr> <tr class=”payment-method”> <th><?php _e( ‘Transaction ID:’, ‘woocommerce-
   pdf-invoices-packing-slips’ ); ?></th> <td><?php echo $this->order->get_transaction_id();?
   > </tr>

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Adding payment transaction id’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-pdf-invoices-packing-slips/assets/icon-256x256.
   png?rev=2189942)
 * [PDF Invoices & Packing Slips for WooCommerce](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/reviews/)

## Tags

 * [transaction id](https://wordpress.org/support/topic-tag/transaction-id/)

 * 11 replies
 * 4 participants
 * Last reply from: [dbosleyjr](https://wordpress.org/support/users/dbosleyjr/)
 * Last activity: [8 years, 8 months ago](https://wordpress.org/support/topic/adding-payment-transaction-id/#post-9578514)
 * Status: resolved