Viewing 1 replies (of 1 total)
  • Plugin Author Saravana Kumar K

    (@mycholan)

    Hi, If I understand correctly, you wanted to display custom fields values to Order Archive Page itself right.?

    You can do some thing like this

    add_filter( 'manage_edit-shop_order_columns', 'my_custom_column_handler' );
    function my_custom_column_handler( $columns ){
    	$new_columns = ( is_array( $columns ) ) ? $columns : array();
    	unset( $new_columns['order_actions'] );
    	$new_columns['custom_column'] = 'CUstom Column';
    	$new_columns['order_actions'] = $columns['order_actions'];
    	return $new_columns;
    }
    
    add_action( 'manage_shop_order_posts_custom_column', 'my_custom_column_value_handler', 2 );
    function my_custom_column_value_handler( $column ){
    	global $post;
    
    	if( $column == "custom_column" ) {
    		// Loop through your order line items & display whatever custom fields you want
    		// using wc_get_order_item_meta( $item_id, $key );
    	}
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Displaying custom fields in the orders’ is closed to new replies.