How to change default PDF invoice file name?

Generally, the Challan PDF Invoice for WooCommerce plugin generates PDFinvoice filename “Invoice-${order_number}.pdf” like this. Here is the way to change the default PDF invoice filename.

1 ) Install the “Code Snippets” plugin from wordpress.org

2 ) Add new snippets

How to change default PDF invoice file name? - 7mywMkTTZWKqhU3q5ar0xf0toLCx4HNkIKKFQOhgogW9oIl9VC62KGzxodzQV5BF37Je87 47tOjqcCa1ZCG D76wv1h WZt8 L6oRN4mdTdw870G6G UNOm61gCQR8MNnBuhBi8oIzNUEAznVAGwnDoHHcb6SeMQAzmNRTxZiaLCXJ jGU4SNDqA

3 ) Here is the filter name and basic structure you should use.

add_filter( 'woo_invoice_file_name', 'woo_invoice_file_name_callback', 10, 3 );

function woo_invoice_file_name_callback( $filename, $template, $order_id ) {
    return 'custom_filename'; // Replace 'custom_filename' with your desired custom name for the PDF invoice
}
Leave a Reply