• Resolved Job

    (@jobd)


    Hi,

    I want to create a extra Admin Columns row in WooCommerce with the Invoice numbers.

    I use this code to create a extra row, it shows the ID Post of a order but i want to change it to the invoice numbers.

    function woo_order_extra_columns($columns)
    {
    
      $newcolumns = array(
    		"cb"       		=> "<input type  = \"checkbox\" />",
    		"order_ID"    => esc_html__('ID', 'woocommerce'),
    	);
    
    	$columns = array_merge($newcolumns, $columns);
    
    	return $columns;
    }
    add_filter("manage_edit-shop_order_columns", "woo_order_extra_columns");
    
    function woo_order_extra_columns_content($column)
    {
    	global $post;
    
    	$order_id = $post->ID;
    
    	switch ($column)
    	{
    		case "order_ID":
    			echo $order_id;
    		break;	
    
    	}
    }
    add_action("manage_posts_custom_column",  "woo_order_extra_columns_content");

    I have to get the invoice data to generate the row with only invoice numbes
    But what do i need or change to get this to work.

    Can you help me.

    https://wordpress.org/plugins/woocommerce-delivery-notes/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Job

    (@jobd)

    I have found the solution by myself.

    This is the code u can use to make invoice number as a single Woocommerce admin order list.

    Set this code in functions.php of your WP theme

    function woo_order_extra_columns($columns)
    {
    
      $newcolumns = array(
    		"cb"       		=> "<input type  = \"checkbox\" />",
    		"invoice_number"    => esc_html__('Factuurnummer', 'woocommerce'),
    	);
    
    	$columns = array_merge($newcolumns, $columns);
    
    	return $columns;
    }
    add_filter("manage_edit-shop_order_columns", "woo_order_extra_columns");
    
    function woo_order_extra_columns_content($column)
    {
    	global $post;
    
    	$invoice_number = wcdn_get_order_invoice_number($post->ID);
    
    	switch ($column)
    	{
    		case "invoice_number":
    			echo $invoice_number;
    		break;	
    
    	}
    }
    add_action("manage_posts_custom_column",  "woo_order_extra_columns_content");

    Hey dude i tried your code

    i need this to

    it didnt work

    this is my code

    any help ?

    function woo_order_extra_columns($columns)
    {

    $newcolumns = array(
    “cb” => “<input type = \”checkbox\” />”,
    “order_ID” => esc_html__(‘invoice_number’, ‘woocommerce’),
    );

    $columns = array_merge($newcolumns, $columns);

    return $columns;
    }
    add_filter(“manage_edit-shop_order_columns”, “woo_order_extra_columns”);

    function woo_order_extra_columns_content($column)
    {
    global $post;

    $invoice_number = wcdn_get_order_invoice_number($post->ID);

    switch ($column)
    {
    case “invoice_number”:
    echo $invoice_number;
    break;

    }
    }
    add_action(“manage_posts_custom_column”, “woo_order_extra_columns_content”);

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WooCommerce Admin Columns’ is closed to new replies.