• Resolved mappel

    (@mappel)


    HI,
    is there a way to put the invoice number next to the header “Invoice”?
    Thanks for helping out and thanks again for this great plugin:)
    Kind regards

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter mappel

    (@mappel)

    I guess I have to use the following line next to the Invoice header?
    <?php echo $this->order->get_invoice_number(); ?>

    but I don’t see where the header “Invoice” is defined in the invoice.php

    Thread Starter mappel

    (@mappel)

    I’ve found this function

    add_filter( ‘wpo_wcpdf_invoice_title’, ‘wpo_wcpdf_invoice_title’ );
    function wpo_wcpdf_invoice_title () {
    $invoice_title = ‘Tax Invoice’;
    return $invoice_title;
    }

    mmmh, if I would know php, I’d know how to put $this->order->get_invoice_number(); into that function

    Plugin Contributor kluver

    (@kluver)

    Hi @mappel,

    The easiest way to do this is with our Professional extension. This will let you add the invoice number to the document title right in the plugin settings.

    You can indeed also use an action hook:

    add_filter( 'wpo_wcpdf_invoice_title', 'wpo_wcpdf_add_invoice_number', 10, 2 );
    function wpo_wcpdf_add_invoice_number ( $title, $document = null ) { 
    	if ( !empty($document) && !empty( $document->order ) ) {
    		$invoice = wcpdf_get_invoice( $document->order );
    		$invoice_number = $invoice->get_invoice_number();
    		$title .= " - " . $invoice_number;
    	}
    	return $title;    
    }

    This would go into the functions.php of your child theme. If you haven’t worked with action hooks or functions.php before please read this: How to use filters

    Thread Starter mappel

    (@mappel)

    so generous from you to provide the hook for my request!
    thank you very much. it works perfectly!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Rename the header “Invoice” to “Invoice-Number: [invoice-number]’ is closed to new replies.