Title: Export filename
Last modified: October 22, 2018

---

# Export filename

 *  Resolved [orderbot](https://wordpress.org/support/users/orderbot/)
 * (@orderbot)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/export-filename/)
 * Hello,
 * I wonder is any option, to set up export filename with such information as:
 * Buyer Company name / or Buyer last name
 * I see it’s possible to set up some word and date as filename is any other option?

Viewing 14 replies - 1 through 14 (of 14 total)

 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/export-filename/#post-10803077)
 * Hello
 * Please, put this code to “Misc Settings”
    and you add use tags {bill_last_name}
   or {bill_company} to filename.
 * Use button “Export w/o progressbar”.
    thanks, Alex
 *     ```
       // add extra tags to filename, use button "Export w/o progressbar"
       add_filter('woe_make_filename_replacements',function($pairs) {
       	$order = new  WC_Order( WC_Order_Export_Engine::$order_id ); // LAST order!
       	$pairs['{bill_last_name}'] = $order->get_billing_last_name();
       	$pairs['{bill_company}'] = $order->get_billing_company();
       	return $pairs;
       });
       ```
   
 *  Thread Starter [orderbot](https://wordpress.org/support/users/orderbot/)
 * (@orderbot)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/export-filename/#post-10803436)
 * Do you mean I should put this code at “Misc Settings” and after at “Custom PHP
   code to modify output” ?
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/export-filename/#post-10803581)
 * yes
 *  Thread Starter [orderbot](https://wordpress.org/support/users/orderbot/)
 * (@orderbot)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/export-filename/#post-10806533)
 * Unfortunately it’s not allow to put code, even if my role is administrator and
   allowed to “edit_themes”
 * Could you advice how I could resolve it?
 *  Thread Starter [orderbot](https://wordpress.org/support/users/orderbot/)
 * (@orderbot)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/export-filename/#post-10806594)
 * Maybe it’s possible to use Code Snippets plug-in to do this?
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/export-filename/#post-10806600)
 * you can just put it in functions.php
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/export-filename/#post-10806602)
 * or yes, you can use mentioned plugin [https://wordpress.org/plugins/code-snippets/](https://wordpress.org/plugins/code-snippets/)
 *  Thread Starter [orderbot](https://wordpress.org/support/users/orderbot/)
 * (@orderbot)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/export-filename/#post-10807365)
 * Cool, it’s work perfectly. Is it also possible to use additional field as a filename
   such data as invoice number / or user role?
 *  Thread Starter [orderbot](https://wordpress.org/support/users/orderbot/)
 * (@orderbot)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/export-filename/#post-10807372)
 * and VAT number, Thanks.
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/export-filename/#post-10807689)
 * It depends on invoicing plugin.
    but should looks like
 *     ```
       $pairs['{vat}'] = get_post_meta($order->get_id(),"field_VAT", true);
       $pairs['{invoice_date}'] = get_post_meta($order->get_id(),"field_Invoice_Date", true);
       ;
       ```
   
 *  Thread Starter [orderbot](https://wordpress.org/support/users/orderbot/)
 * (@orderbot)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/export-filename/#post-10820827)
 * Hi again,
 * I mean customer company VAT registration number, and Invoice No. Invoicing plugin
   WooCommerce PDF Invoices & Packing Slips (premium template)
 * meta key for invoice number, _wcpdf_invoice_number
    meta key for VAT number, 
   VAT Number
 * and also would be needed Customer Role.
 * Could you help with these fields export to Filename?
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/export-filename/#post-10820951)
 * ok, here is final version
 *     ```
       // add extra tags to filename, use button "Export w/o progressbar"
       add_filter('woe_make_filename_replacements',function($pairs) {
       	if( !WC_Order_Export_Engine::$order_id )
       		return $pairs;
       	$order = new  WC_Order( WC_Order_Export_Engine::$order_id ); // LAST order!
       	$pairs['{bill_last_name}'] = $order->get_billing_last_name();
       	$pairs['{bill_company}'] = $order->get_billing_company();
       	$pairs['{vat_number}'] = get_post_meta($order->get_id(), "VAT Number", true);
       	$pairs['{invoice_number}'] = get_post_meta($order->get_id(), "_wcpdf_invoice_number", true);
   
       	$user = $order->get_user();
       	$pairs['{user_role}'] = $user ? $user->roles[0] : 'guest'; 
       	return $pairs;
       });
       ```
   
    -  This reply was modified 7 years, 9 months ago by [algol.plus](https://wordpress.org/support/users/algolplus/).
 *  Thread Starter [orderbot](https://wordpress.org/support/users/orderbot/)
 * (@orderbot)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/export-filename/#post-10821303)
 * Cool, it’s work perfectly. Thank you, Great plug-in! Good luck
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/export-filename/#post-10822402)
 * you’re welcome.
    have a good weekend

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Export filename’ is closed to new replies.

 * ![](https://ps.w.org/woo-order-export-lite/assets/icon-256x256.png?rev=1365554)
 * [Advanced Order Export For WooCommerce](https://wordpress.org/plugins/woo-order-export-lite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-order-export-lite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-order-export-lite/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-order-export-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-order-export-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-order-export-lite/reviews/)

 * 14 replies
 * 2 participants
 * Last reply from: [algol.plus](https://wordpress.org/support/users/algolplus/)
 * Last activity: [7 years, 9 months ago](https://wordpress.org/support/topic/export-filename/#post-10822402)
 * Status: resolved