Skip to content

Instantly share code, notes, and snippets.

@maxrice
Last active December 23, 2015 00:29
Show Gist options
  • Save maxrice/6553930 to your computer and use it in GitHub Desktop.
Save maxrice/6553930 to your computer and use it in GitHub Desktop.
Add custom fields to XML for the WooCommerce Customer/Order XML Export Suite
<?php
function add_custom_fields_to_xml( $order_data, $order ) {
$order_data['BillingCompanyID'] = ( isset( $order->order_custom_fields['billing_company_id'][0] ) ) ? $order->order_custom_fields['billing_company_id'][0] : '';
$order_data['BillingCompanyVAT'] = ( isset( $order->order_custom_fields['billing_company_vat'][0] ) ) ? $order->order_custom_fields['billing_company_vat'][0] : '';
return $order_data;
}
add_filter( 'wc_customer_order_xml_export_suite_order_export_order_list_format', 'add_custom_fields_to_xml', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment