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
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.