Viewing 4 replies - 1 through 4 (of 4 total)
  • You can use following code. Add this to theme’s functions.php file.

    function wpg_add_columns($cols) {
    
    	$cols['wc_settings_tab_order_date'] = __('Order Date', 'mytheme');
    	return $cols;
    }
    add_filter('wpg_order_columns', 'wpg_add_columns');
    
    function wpg_add_fields($settings) {
    
    	$settings['payment_method'] = array(
    								'name' => __( 'Order date', 'woocommerce-simply-order-export' ),
    								'type' => 'checkbox',
    								'desc' => __( 'Order date', 'woocommerce-simply-order-export' ),
    								'id'   => 'wc_settings_tab_order_date'
    							);
    
    	return $settings;
    
    }
    add_filter('wc_settings_tab_order_export', 'wpg_add_fields');
    
    function csv_write( &$csv, $od, $field ) {
    
    	switch( $field ) {
    
    		case 'wc_settings_tab_order_date':
    			array_push( $csv, $od->order_date );
    		break;
    
    		default :
    			break;
    	}
    
    }
    add_action('wpg_add_values_to_csv', 'csv_write', 10, 3);

    This is working snippet.

    Thread Starter charlie16

    (@charlie16)

    Thank you, that worked.

    In the above code$settings['payment_method'] = array(
    Should it instead be $settings['order_date'] = array(
    ?

    Yes you are right.. It’s my mistake.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Order Date’ is closed to new replies.