• Resolved Ali Husnain

    (@alihusnainarshad)


    Hello Dear, I created a custom templete.

    I want to print the payment date.

    <tr class="payment-date">
    <th><?php _e( 'Payment Date:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
    <td><?php echo $this->order->get_date_paid()->format ('Y-m-d');?></td>
    </tr>

    It’s working when the order has a payment date, in case if there is no payment date. Null Error. PHP

    Can you please guide a little

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

Viewing 1 replies (of 1 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hello @alihusnainarshad

    Try this instead:

    <?php if( $payment_date = $this->order->get_date_paid() ) : ?>
        <tr class="payment-date">
        <th><?php _e( 'Payment Date:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
        <td><?php echo $payment_date->format ('Y-m-d'); ?></td>
        </tr>
    <?php endif; ?>

    In alternative i would suggest you to use our Premium Templates extension because it threats that verification for you. You just need to create a custom block and add this placeholder {{date_paid}}.

    • This reply was modified 4 years, 10 months ago by alexmigf.
    • This reply was modified 4 years, 10 months ago by alexmigf.
Viewing 1 replies (of 1 total)
  • The topic ‘Print the Payment Date’ is closed to new replies.