Actually you can still add meta boxes to the new order table, you just need to change the screen parameter. This is how I have done in my plugin:
// Register action in constructor or init method
add_action( 'add_meta_boxes', array( $this, 'meta_boxes' ) );
public function meta_boxes() {
// Add meta box to old orders screen (using posts table)
add_meta_box(
'my-plugin-id',
__( 'My Plugin Meta Box Title', 'my-plugin-namespace' ),
array( $this, 'meta_box_output' ),
'shop_order',
'side',
'high'
);
// Add meta box to new orders screen (using orders table)
add_meta_box(
'my-plugin-id',
__( 'My Plugin Meta Box Title', 'my-plugin-namespace' ),
array( $this, 'meta_box_output' ),
'woocommerce_page_wc-orders',
'side',
'high'
);
}
And in the meta_box_output
function, I simply get the order like this:
public function meta_box_output( $order ) {
if ( get_class( $order ) === 'WP_Post' ) {
$order = wc_get_order( $order->ID );
}
// Do stuff with $order
}