Professional Extension #
If you own a license of the Professional extension or our PDF Invoice extensions bundle, you can change the title of the document simply via the plugin settings. Go to WooCommerce > PDF Invoices > Documents > (document of your choice), where you’ll find a field to enter the title of your choice:
Free version #
If you want to change the title of the Invoice or Packing Slip in the free version, you can do this by filtering the title. You could also create a custom template and simply edit the title manually, but if the document title is the only thing you’re changing, than using the filter is a better option because your template will always be up to date.
You can use the following filter:
Hook | Description | Arguments |
---|---|---|
wpo_wcpdf_document_title | Filter the title of the PDF document | string $title , object $document |
New to using filters? Read this first: How to use filters
Example 1: Change “Invoice” to “Tax Invoice” #
Add the following to your themes functions.php
(read this if you haven’t edited that file before!):
add_filter( 'wpo_wcpdf_document_title', 'wpo_wcpdf_invoice_title', 10, 2 ); function wpo_wcpdf_invoice_title( $title, $document ) { if ( 'invoice' === $document->get_type() ) { $title = 'Tax Invoice'; } return $title; }
Example 2: Change “Packing Slip” to “Delivery Note” #
add_filter( 'wpo_wcpdf_document_title', 'wpo_wcpdf_packing_slip_title', 10, 2 ); function wpo_wcpdf_packing_slip_title( $title, $document ) { if ( 'packing-slip' === $document->get_type() ) { $title = 'Delivery Note'; } return $title; }
An alternative method that is also update proof, is by using custom translations. You can then also easily modify the filename. Even if your site is in English, you could still use a custom ‘translation’, by using en_GB
or en_US
, depending on your specific WordPress settings.
You can also use the plugin Say What? to make specific replacements. Make sure to use the exact original (English) string, including capitals, and the text domain woocommerce-pdf-invoices-packing-slips
.