Hi @ascaron4o,
What are you trying to do?
Hi, I’m trying to add shortcode from another plugin to the invoice template in order to show the information I want on the invoice.
Plugin Contributor
dwpriv
(@dwpriv)
What error do you get in your logs as outlined here? You’re looking for logs prefixed with wpo_wcpdf
or fatal_errors
-
This reply was modified 10 months, 1 week ago by
dwpriv. Reason: fixed incorrect link
in wpo_wcpdf – Fatal error: Call to a member function get_items() on bool ..(/home/..leading to plugin file dir)
Problem is if I hardcoded it like so:
<?php echo do_shortcode('[shortcode order_id="23123"]'); ?>
its working, but if I try to put it dynamically like so:
<?php echo do_shortcode('[shortcode order_id="' . $this->order_number() . '"]'); ?>
It’s not working.
So what is the right way to put the order number dynamically in the invoice.php?
-
This reply was modified 10 months, 1 week ago by
ascanatian.
-
This reply was modified 10 months, 1 week ago by
ascanatian.
-
This reply was modified 10 months, 1 week ago by
ascanatian.
-
This reply was modified 10 months, 1 week ago by
ascanatian.
Plugin Contributor
dwpriv
(@dwpriv)
Are you adding this in a custom template? If so, you can try this:
$this->order->get_order_number();
If not, how are you adding the snippet and where are you trying to print the information on the invoice?
Perfect, now it works!
<?php echo do_shortcode('[shortcode order_id="' . $this->order->get_order_number() . '"]'); ?>
And yes, I’m adding in custom invoice.php template -> woocommerce/pdf/theme/invoice.php
Thanks a lot!
Plugin Contributor
dwpriv
(@dwpriv)
No problem and thanks for your confirmation. I will mark this topic as resolved π