Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor 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

    Hello, I pastetd this snippet to functions.php and I won’t show on my invoice.
    Any idea why its not working?
    Thanks!

    Plugin Contributor dwpriv

    (@dwpriv)

    @emcadesign the snippet shows the due date as a normal date but with 30 days added to it. You can adjust the days in the snippet.

    However, could you try using the snippet with the Code Snippets plugin and see if that works?

    If that doesn’t work, could you share a screenshot of what you pasted?

    Additionally, are you using a plugin for your due dates?

    Best regards

    What plugin do you mean?

    Plugin Contributor dwpriv

    (@dwpriv)

    @emcadesign

    I was asking if you were using a plugin to generate your due dates

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Set due date on invoices’ is closed to new replies.