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

    (@pomegranate)

    Hi! Thanks for the compliments, glad to hear you like the plugin ??
    Do you mean the due date or the date on which it was paid?

    Not all payment gateways store the paid date, but if yours do, you can use the _paid_date custom field:

    add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_paid_date', 10, 2 );
    function wpo_wcpdf_paid_date ($template_type, $order) {
        global $wpo_wcpdf;
        if ($template_type == 'invoice') {
            ?>
            <tr class="paid-date">
                <th>Paid Date:</th>
                <td><?php $wpo_wcpdf->custom_field('_paid_date'); ?></td>
            </tr>
            <?php
        }
    }

    You can add this filter with Code Snippets or via your theme functions.php. Read this first if you haven’t worked with filters before!

    Ewout

    Thread Starter kronoswolf

    (@kronoswolf)

    The date on which it was paid. I’ll confirm manually clicking on “Completed”.

    It’s not a big deal but I think it’s good for the customers to see the date of payment.

    I’ll make some tests with this code and return here, but since now thanks for quick answer and your attention!

    Plugin Contributor Ewout

    (@pomegranate)

    Ok great – let me know if you have any other questions!

    Ewout

    Thread Starter kronoswolf

    (@kronoswolf)

    Hi Ewout!

    It didn’t work, but I modified “_paid_date” to “_completed_date” and that’s exactly what I needed, thank you for the help!

    Could you please help just with one more thing? The date format is not my configured date format, how can I use the corret date format with this code?

    Thank you so much!

    add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_completed_date', 10, 2 );
    function wpo_wcpdf_completed_date ($template_type, $order) {
        global $wpo_wcpdf;
        if ($template_type == 'invoice') {
            ?>
            <tr class="completed-date">
                <th>Pago em:</th>
                <td><?php $wpo_wcpdf->custom_field('_completed_date'); ?></td>
            </tr>
            <?php
        }
    }
    Plugin Contributor Ewout

    (@pomegranate)

    Hi! Of course, I completely forgot about that ??

    add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_completed_date', 10, 2 );
    function wpo_wcpdf_completed_date ($template_type, $order) {
        global $wpo_wcpdf;
        if ($template_type == 'invoice') {
            ?>
            <tr class="completed-date">
                <th>Pago em:</th>
                <td><?php echo date_i18n( get_option( 'date_format' ), strtotime( $order->completed_date ) ); ?></td>
            </tr>
            <?php
        }
    }

    Hope that helps ??
    Ewout

    Thread Starter kronoswolf

    (@kronoswolf)

    Perfect! Thank you so much for the help Ewout. Hope this can help others users too.

    Cheers

    Plugin Contributor Ewout

    (@pomegranate)

    You’re welcome, glad I could help! If you can spare a minute, I would really appreciate a plugin review here on www.ads-software.com.

    Thanks in advance and have a fantastic day!
    Ewout

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Add Payment Date to Invoice’ is closed to new replies.