Plugin Contributor
Ewout
(@pomegranate)
Hello Nicmare,
First of all, I apologize for the late reply – I was on vacation for a week and returned yesterday.
You can use the following code in your template to display the payment instructions:
<?php do_action( 'woocommerce_thankyou_' . $wpo_wcpdf->export->order->payment_method, $wpo_wcpdf->export->order->id ); ?>
Hope that helps!
Ewout
No problem Ewout! Welcome back! Better late than never ;-).
Okay – i inserted the hook to my pdf template. But it outputs nothing! no payment instructions 🙁
even if i try it with static code, there is no text:
<?php do_action( 'woocommerce_thankyou_bacs', 669 ); ?>
Plugin Contributor
Ewout
(@pomegranate)
Hello Nicmare,
You are right. WooCommerce 2.2 came with some memory optimizations, and one of them is that it doesn’t load any of the classes until they are actually needed, so the gateways are not initiated yet here. This is very simple to fix though, by using the following code:
<?php
WC()->payment_gateways();
do_action( 'woocommerce_thankyou_' . $wpo_wcpdf->export->order->payment_method, $wpo_wcpdf->export->order->id ); ?>
?>
That should do the trick! Let me know if there’s anything else that you need help with though!
Ewout
thank you – finally this works! (but just for “bacs” which is okay for me)
Plugin Contributor
Ewout
(@pomegranate)
Glad to hear that. It should work for other payment methods with instructions setup in the settings too though, but perhaps you have not enabled them/filled them in?
I just tested with woocommerce_thankyou_cheque
and woocommerce_thankyou_cod
and they both work for me.
Have a great day!
Ewout
p.s. I just noticed I left an extra ?>
in the code snippet, in case you missed it.