2016-03-08 66 views
0

我正在使用WooCommerce客戶/訂單CSV導出插件,並希望在我的主題functions.php中使用代碼段來創建所需的CSV格式。下一個代碼片段使用數據填充新列,但我想在第4列中將一些WooCommerce結帳字段組合在一起,但我該怎麼做?分級顯示的代碼不工作..WooCommerce合併CSV字段導出的字段

function wc_csv_export_modify_row_data($order_data, $order, $csv_generator) {

$custom_data = array(
    'column_1' => '2', 
    'column_2' => '302115', 
    'column_3' => '[Klant]', 
    'column_4' => get_post_meta($order->id, '_shipping_first_name', true), 
    /*'column_4' => $order_data['_shipping_first_name'].''.['_shipping_last_name'].'¶'. 
        $order_data['_shipping_address_1'].'¶'. 
        $order_data['_shipping_address_2'].'¶'.''.'¶'. 
        $order_data['_shipping_postcode'].'¶'. 
        $order_data['_shipping_city'].'¶'. 
        $order_data['_shipping_country'].'¶'. 
        $order_data['_billing_email'].'¶'. 
        $order_data['_shipping_company'],*/ 
    'column_5' => 'SEL' 
); 

回答

1

我需要一些我們的訂單的出口也這麼做。以下是我的做法 -

$custom_data = array(
    // combine first name and last name to 1 field 
    'Ship_to_Name' => get_post_meta($order->id, '_shipping_first_name', true)." ".get_post_meta($order->id, '_shipping_last_name', true), 
); 
+0

謝謝你,這是我的問題的答案! – Sjors