How to show hide columns in the Stock Manager Table?

Suppose you want to remove the “name” field from “Inventory Manager”. Then add the following code in the function.php of your theme to remove this : ‘

add_filter( 'set_products_data_headers', 'remove_name_from_table' );

function remove_name_from_table( $table_header ) {
    unset( $table_header[ 'name' ] );
    return $table_header;
}

add_filter('get_prepared_product_data', 'remove_name_from_table_body', 3);

function remove_name_from_table_body( $table_data, $product_id, $product ) {
    unset($table_data['name']);
    return $table_data;
}

Leave a Reply