• Resolved lorndal

    (@lorndal)


    hello,
    how can I add the status “canceled” to the .pdf-invoice of the plugin “WooCommerce PDF Invoices & Packing Slips” ?
    It should only be printed on the .pdf-invoice, when the status of the order is set to “canceled” in the backend of the order.

    I could′t find any setting-options in the plugin-options.
    Just copied the template-files of the plugin to my child-theme and searched for any functions or hooks, but couldn′t find some.

    Is it possible, to set this text-information “canceled” to the .pdf-invoice when the order is canceled?

    Thank you nice greetings

    • This topic was modified 4 years, 9 months ago by lorndal.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor kluver

    (@kluver)

    Hi @lorndal,

    That is certainly possible. You can use the following code snippet for that:

    add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_add_status_to_invoice_when_order_is_cancelled', 10, 2 );
    function wpo_wcpdf_add_status_to_invoice_when_order_is_cancelled( $template_type, $order ) {
    	if ( $order->get_status() == 'cancelled' && $template_type == 'invoice' ) {
    		?>
    		<tr class="order-status">
    			<th>Order status:</th>
    			<td>Cancelled</td>
    		</tr>
    		<?php
    	}
    }

    This code snippet should be added to the functions.php of your child theme or via a plugin like Code Snippets. If you haven’t worked with code snippets or functions.php before please read this: How to use filters

    Thread Starter lorndal

    (@lorndal)

    Hi Kluver,
    thank you a lot. It works fine.
    Nice greetings

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘add status “canceled” to .pdf invoice’ is closed to new replies.