Hi @djohnnysk,
The Due Date option is intended to display a date in the future (1 day or higher), but if you want to use the same invoice date as due date, please try the following code snippet:
/**
* PDF Invoices & Packing Slips for WooCommerce:
* Display the invoice date as the due date (same date)
*/
add_action( 'wpo_wcpdf_after_order_data', function( $document_type, $order ) {
if ( 'invoice' === $document_type ) {
$invoice = wcpdf_get_invoice( $order );
?>
<tr class="due-date">
<th>Due Date:</th>
<td><?php $invoice->date( $document_type ) ?></td>
</tr>
<?php
}
}, 10, 2 );
If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use code snippets
In brief, if you have a child theme, you can add code snippets in its functions.php file: don’t add code snippets to the functions.php file from your parent theme, because you may lose your customizations after updating your parent theme! The another way to add code snippets, that is safer in my humble opinion, is to use the Code Snippets plugin: This plugin stores the code snippets in your database, so you don’t have to worry about losing your customizations after updating your plugins or theme 😉
Thanks, the snippet works, but the Due Date is displayed in the last line.
Is there an easy way to display the Due Date under the Invoice Date? 🙂
Hi @djohnnysk,
Unfortunately, we have actions before and after the order data only. If you want to display the due date in that specific place, you should create a custom PDF template to achieve it.