Created
November 18, 2014 23:26
-
-
Save maxrice/1c1bbfa041b1bfcde4cb to your computer and use it in GitHub Desktop.
Replace WooCommerce Customer/Order XML Export output with a totally custom format :)
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_xml_export_output_custom_format( $output, $order_data ) { | |
$output = ''; | |
foreach ( $order_data['Orders']['Order'] as $order ) { | |
$output .= "--START ORDER--\n"; | |
$output .= "ID: {$order['OrderId']}\n"; | |
$output .= "--END ORDER--\n"; | |
} | |
return $output; | |
} | |
add_filter( 'wc_customer_order_xml_export_suite_generated_xml', 'wc_xml_export_output_custom_format', 10, 2 ); | |
/* This will render the output like: | |
--START ORDER-- | |
ID: 190 | |
--END ORDER-- | |
Note that you can use other filters in the plugin to change the file extension and content-type (for download) if desired. | |
*/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment