Viewing 4 replies - 1 through 4 (of 4 total)
  • ankitgadertcampcom

    (@ankitgadertcampcom)

    Hi,

    Yes, it is possible to export the billing first name and billing last name in same column with the add-on (with help of a small code snippet)

    Please ask your question on add-on support forum, if you have already purchased it.

    Support forum for add-on plugin: https://sharethingz.com/support/forum/woocommerce-simply-order-export-addon/

    Regards

    Thread Starter leonardinha

    (@leonardinha)

    Sure, thank you!!! Done!

    ankitgadertcampcom

    (@ankitgadertcampcom)

    You can add following code to theme’s functions.php file

    function add_fields_init() {
    
    	add_filter('wsoe_filter_fields', 'wsoe_add_billing_fields');
    	add_filter( 'not_in_meta', function( $not_in_meta ) { array_push( $not_in_meta, 'full_billing_name' ); return $not_in_meta; } );
    	add_action('wsoe_addon_add_to_csv', 'wsoe_add_billing_name', 10, 6 );
    
    }
    add_action('init', 'add_fields_init', 8);
    
    function wsoe_add_billing_fields( $fields ) {
    
    	$fields['wc_settings_tab_full_billing_name'] = __('Billing Full Name', 'woocommerce-simply-order-export-add-on');
    	return $fields;
    }
    
    function wsoe_add_billing_name( &$csv_values, $order_details, $key, $fields, $item_id, $current_item ) {
    
    	switch ( $key ) {
    
    		case 'full_billing_name':
    			$billing_f_name = get_post_meta( $order_details->id, '_billing_first_name', true );
    			$billing_l_name = get_post_meta( $order_details->id, '_billing_last_name', true );
    			$billing_full_name = trim($billing_f_name.' '. $billing_l_name);
    			array_push($csv_values, $billing_full_name);
    		break;
    
    		default	:
    		break;
    	}
    }

    Let me know if it helps.

    Note: This code would only work if add-on is installed.

    Thread Starter leonardinha

    (@leonardinha)

    It works perfectly! Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Billing first name billing last name in same column’ is closed to new replies.