Created
May 5, 2014 16:57
-
-
Save maxrice/8e2b39fbc10e101b8684 to your computer and use it in GitHub Desktop.
WooCommerce Customer/Order CSV Export - Add %%order_numbers%% filename variable to support Sequential Order Numbers Pro order numbers in filename :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wc_csv_export_edit_filename( $post_replace_filename, $pre_replace_filename, $order_ids ) { | |
// only for orders | |
if ( false !== strpos( $pre_replace_filename, '%%order_numbers%%' ) ) { | |
$order_numbers = array(); | |
foreach ( $order_ids as $id ) { | |
$order = new WC_Order( $id ); | |
$order_numbers[] = $order->get_order_number(); | |
} | |
$post_replace_filename = str_replace( '%%order_numbers%%', implode( '-', $order_numbers ), $post_replace_filename ); | |
} | |
return $post_replace_filename; | |
} | |
add_filter( 'wc_customer_order_csv_export_filename', 'wc_csv_export_edit_filename', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment