Created
April 17, 2015 08:11
-
-
Save tamarazuk/ee6212e703faabefba41 to your computer and use it in GitHub Desktop.
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
function sv_add_weight_to_csv_export_import_format( $order_data, $order ) { | |
$count = 1; | |
// add line items | |
foreach ( $order->get_items() as $item ) { | |
$product = $order->get_product_from_item( $item ); | |
if ( ! is_object( $product ) ) { | |
$product = new WC_Product( 0 ); | |
} | |
if ( $weight = $product->get_weight() ) { | |
$order_data[ "order_item_{$count}" ] .= '|weight: ' . $weight; | |
} | |
$count++; | |
} | |
return $order_data; | |
} | |
add_filter( 'wc_customer_order_csv_export_order_row', 'sv_add_weight_to_csv_export_import_format', 20, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment