Forum Replies Created

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

    (@atmadja)

    Edit : I found the solution.

    Here is the code I use :

    // Add a new custom column to admin order list
    add_filter( 'manage_edit-shop_order_columns', 'admin_orders_list_add_column', 10, 1 );
    function admin_orders_list_add_column( $columns ){
        $columns['custom_column'] = __( 'New Column', 'woocommerce' );
    
        return $columns;
    }
    
    // The data of the new custom column in admin order list
    add_action( 'manage_shop_order_posts_custom_column' , 'admin_orders_list_column_content', 10, 2 );
    function admin_orders_list_column_content( $column, $post_id ){
        global $the_order;
    
        if( 'custom_column' === $column ){
            $count = 0;
    
            // Loop through order items
            foreach( $the_order->get_items() as $item_id => $item ) {
            	$allmeta = $item->get_meta_data();
            	$somemeta = $item->get_meta( 'Plat', true );
    
                // Display order meta data
            	//print_r($allmeta);
            	print_r($somemeta);
    
                $count++;
            }
        }
    }

    If someone need, the meta key (in my case “Plat”) can be found here :

    Hope this post will help you.
    Thanks community.

    Thread Starter atmadja

    (@atmadja)

    Ok, so I found the problem.
    It must be a problem with my browser cache or someting like that because with an other browser i can now publish pages.
    And after a simple restart of my original chrome browser, it also works know.
    Hope it will help someone in the same case.

Viewing 2 replies - 1 through 2 (of 2 total)