• Resolved Anonymous User 12711743

    (@anonymized-12711743)


    Hi,

    can we add payment transaction id at the payment method row?

    Ian

Viewing 11 replies - 1 through 11 (of 11 total)
  • 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)

    any solutions?

    Plugin Contributor Ewout

    (@pomegranate)

    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

    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

    (@pomegranate)

    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 – thanks in advance and have a fantastic weekend!

    Ewout

    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

    (@pomegranate)

    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 ??

    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

    Where did you place this code? Trying to get it to work on my end.

    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!

    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.