Print Invoice and Packing slip plugin have provisions to attach invoices in PDF format to the WooCommerce Order email.
You may also need to have a custom filename for the PDF invoices. There are options to add custom prefixes with the order number or invoice number as the PDF filename.
Get started
- First of all, install and activate the plugin, a new menu Invoice/Packing appears in the WordPress dashboard.
- Head on to Invoice/Packing > Invoice menu. The invoice settingswindow will open up.
OR - Go to General Settings > Documents tab > Invoice > Settings.
Custom PDF name
From the invoice settings window, go to the Advanced tab. Scroll down to the settings PDF name format.
The plugin allows adding name format in the combination of prefix with order number or invoice number.
- PDF name format: Select a name format for PDF invoice that includes invoice/order number.
- Custom prefix: Input a custom prefix for ‘PDF name format’ that will appear at the beginning of the name. Defaulted to ‘Invoice_’.
However, you can make use of the following code snippets to add custom filename for PDF invoice/proforma invoice.
Custom filename for invoices/proforma invoice
To append a prefix for the PDF invoice, insert the below-given code snippet in the active theme’s functions.php file.
Here, the file name invoice_1234 is changed to facture_1234 for a single order. Similarly, for bulk orders, the name invoice_bulk_1000-1001-1003 is changed to facture_bulk_1000-1001-1003. However, you can replace the text facture with the customized texts of your choice to obtain the PDF invoice with that filename.
To have a custom filename for both invoice and proforma invoice, then, insert the below-given code snippet to the active theme’s functions.php file.
Replace the facture with the text of your choice to get the invoice/ proforma invoice with that filename.
Invoice Number as PDF invoice filename
To set the invoice number as the PDF invoice filename, insert the below-given code snippet in the active theme’s functions.php file.
Custom proforma invoice number as proforma PDF name
To set custom proforma invoice number as proforma PDF name, insert the below-given code snippet in the active theme’s functions.php file.