• Resolved katmacau

    (@katmacau)


    Hello. Can we include the order status on the invoice? Eg pending payment, paid/completed etc.

    I tried adding:

    <?php <tr class="order-status">
    <th>Order Status</th>
    <td><?php $this->get_status();?></td>
    </tr> ?>

    However that gave this error: 200: parsererror

    Is it possible?

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

    (@mohamadntr)

    Hi @katmacau,

    Please add this code snippet to your website:

    /**
    * WP Overnight - PDF Invoices & Packing Slips for WooCommerce
    * Add the order status to the order data section of the document.
    *
    * @param $document_type
    * @param $order
    *
    * @return void
    */
    function wpo_order_status_after_order_data( $document_type, $order ) {
    echo '<tr class="order-status">
    <th>Order Status</th>
    <td>', $order->get_status(), '</td>
    </tr>';
    }

    add_action( 'wpo_wcpdf_after_order_data', 'wpo_order_status_after_order_data', 10, 2 );

    Best regards

    Thread Starter katmacau

    (@katmacau)

    Thanks for the quick response. That was great. I tweaked it a little so I could mark orders as paid/unpaid. Sharing in case someone else finds this useful.

    /* Add order status to PDF invoice */
    function wpo_order_status_after_order_data( $document_type, $order ) {
    $order_status = $order->get_status();
    if($order_status == "completed") $order_status = "PAID";
    if($order_status == "pending" || $order_status == "on-hold") $order_status = "Unpaid";

    echo '<tr class="order-status">
    <th>Order Status:</th>
    <td>', $order_status, '</td>
    </tr>';
    }
    add_action( 'wpo_wcpdf_after_order_data', 'wpo_order_status_after_order_data', 10, 2 );

    As a feature suggestion you could setup allowing users to set up this on your plugins side with custom labels depending on order status.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Include order status in PDF’ is closed to new replies.