Skip to content

Instantly share code, notes, and snippets.

@maxrice
Created November 18, 2014 23:26
Show Gist options
  • Save maxrice/1c1bbfa041b1bfcde4cb to your computer and use it in GitHub Desktop.
Save maxrice/1c1bbfa041b1bfcde4cb to your computer and use it in GitHub Desktop.
Replace WooCommerce Customer/Order XML Export output with a totally custom format :)
<?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