Im trying to add the Delivery Date from the YITH Delivery Date plugin to display on a custom invoice template.
In my \woocommerce\pdf\Custom\template-functions.php
I added the following action as per the documentation https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/creating-a-custom-pdf-template/:
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
add_action( ‘wpo_wcpdf_after_order_data’, ‘wpo_wcpdf_delivery_date’, 10, 2);
function wpo_wcpdf_delivery_date($template_type, $order) {
$document = wcpdf_get_document($template_type, $order);
print_r($document);
?>
<tr class=”delivery-date”>
<th>Delivery Date:</th>
<td><?php echo date_i18n( 'd M Y', strtotime( $document->get_custom_field('ywcdd_order_delivery_date') ) ); ?></td>
</tr>
<?php
}
?>
On the invoice.php I am calling the action/hook like this:
<?php do_action( 'wpo_wcpdf_after_order_data', $this->type, $this->order ); ?>
The result, nothing is appearing on the invoice PDF to do with the delivery date, would anyone know what's going on?
Also this article is exactly what I'm trying to achieve https://wordpress.org/support/topic/urgent-delivery-date-on-invoice-help-please/
(WooCommerce Version 4.5.1 | Wordpress Version 5.4.4)