• Resolved johanfranzon

    (@johanfranzon)


    Hi,

    After upgrading I got a problem with the due date. It shows the correct day and month, but instead of the correct year its just what appears to be a random number, for instance 4306.

    The code I’m using:

    add_action( ‘wpo_wcpdf_after_order_data’, ‘wpo_wcpdf_due_date’, 10, 2 );
    function wpo_wcpdf_due_date ($template_type, $order) {
    if ($template_type == ‘invoice’) { // put due date only on invoice
    $invoice_date = method_exists($order, ‘get_meta’) ? $order->get_meta(‘_wcpdf_invoice_date’,true,’edit’) : get_post_meta( $order->id, ‘_wcpdf_invoice_date’, true );
    $due_date = date_i18n( get_option( ‘date_format’ ), strtotime( $invoice_date . ‘ + 15 days’) );
    ?>
    <tr class=”due-date”>
    <th>F?rfallodatum:</th>
    <td><?php echo $due_date; ?></td>
    </tr>
    <?php
    }
    }

    Best regards
    Johan

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hello Johan,
    The snippet you used needs to be updated to be compatible with WooCommerce 3.X and PDF Invoices 2.X. You can find the updated snippet in the documentation: Print a due date on the invoice

    Let me know if you still have issues after updating the snippet though!

    Ewout

    Thread Starter johanfranzon

    (@johanfranzon)

    Hi,

    It worked nice!

    Thanks a lot!

    Johan

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Due date show wrong year’ is closed to new replies.