Pdf file name customization
-
Hi Ewot,
You had helped me earlier with customization of pdf file name.
Need some more help.
I am using the following code now to get pdf invoice in format Y-m-d-Invoice-No.pdf/** PDF Invoice File name - Replace ‘invoice’ with 'Фактура' */ add_filter( 'wpo_wcpdf_filename', 'wpo_wcpdf_custom_filename', 10, 4 ); function wpo_wcpdf_custom_filename( $filename, $template_type, $order_ids, $context ) { $invoice_string = _n( 'invoice', 'invoices', count($order_ids), 'wpo_wcpdf' ); if ( $order_ids == 1 ) { $suffix = $number; } else { $suffix = date('Y-m-d'); // 2020-11-11 } $new_prefix = _n( $suffix . '-' . 'Фактура', $suffix . '-' . '-Фактури', count($order_ids), 'wpo_wcpdf' ); $new_filename = str_replace($invoice_string, $new_prefix, $filename); return $new_filename; }
It works for current date. Please help me how to get the file name with the invoice date.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Pdf file name customization’ is closed to new replies.