Include Origin column for non-HPOS orders table
This commit is contained in:
parent
79fed9cac9
commit
07312708d1
|
@ -400,25 +400,23 @@ class SourceAttributionController implements RegisterHooksInterface {
|
|||
private function register_order_origin_column() {
|
||||
$screen_id = $this->get_order_screen_id();
|
||||
|
||||
add_filter(
|
||||
"manage_{$screen_id}_columns",
|
||||
function( $columns ) {
|
||||
$add_column = function( $columns ) {
|
||||
$columns['origin'] = esc_html__( 'Origin', 'woocommerce' );
|
||||
|
||||
return $columns;
|
||||
}
|
||||
);
|
||||
};
|
||||
// HPOS and non-HPOS use different hooks.
|
||||
add_filter( "manage_{$screen_id}_columns", $add_column );
|
||||
add_filter( "manage_edit-{$screen_id}_columns", $add_column );
|
||||
|
||||
add_action(
|
||||
"manage_{$screen_id}_custom_column",
|
||||
function( $column_name, $order_id ) {
|
||||
$display_column = function( $column_name, $order_id ) {
|
||||
if ( 'origin' !== $column_name ) {
|
||||
return;
|
||||
}
|
||||
$this->display_origin_column( $order_id );
|
||||
},
|
||||
10,
|
||||
2
|
||||
);
|
||||
};
|
||||
// HPOS and non-HPOS use different hooks.
|
||||
add_action( "manage_{$screen_id}_custom_column", $display_column, 10, 2 );
|
||||
add_action( "manage_{$screen_id}_posts_custom_column", $display_column, 10, 2 );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue