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

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

<!-- wp:paragraph -->
<p>add_filter( 'woo_invoice_file_name', 'woo_invoice_file_name_callback', 10, 3 );</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>function woo_invoice_delivery_date ($filename, $template, $order_id) {</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>&nbsp;&nbsp;&nbsp;return 'custom_filename';// custom name of pdf invoice</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>}</p>
<!-- /wp:paragraph -->

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.