Set due date on invoices

Plugin Support
dwpriv

(@dwpriv)

@hellerobgmailcom

That guide relates to using custom fields in the Customizer. You would need a license for our Premium Templates add-on to have access to the Customizer. However, you can try this code snippet to add a due date to the invoices:

/**
 * Show the due date on the invoice
 */
add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_due_date', 10, 2 );
function wpo_wcpdf_due_date ($document_type, $order) {
    if ($document_type == 'invoice') { // put due date only on invoice
        $invoice = wcpdf_get_invoice( $order );
        if ( $invoice_date = $invoice->get_date() ) {
            $due_date = date_i18n( get_option( 'date_format' ), strtotime( $invoice_date->date_i18n('Y-m-d H:i:s') . ' + 30 days') );
            ?>
            <tr class="due-date">
                <th>Due Date:</th>
                <td><?php echo $due_date; ?></td>
            </tr>
            <?php
        }
    }
}

If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters

Best regards

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer