Sometimes you want to add an additional column to your dashboard so you can have a better overview and more information on your products list.
1. Using FTP manager (filezila), open your theme folder (child theme) and open file functions.php.
If you are not familiar with FTP you can install the WP File Manager plugin for WordPress and use it as well.
In my example, I’m going to define a new column Season that will show me what seasons are products.
In order to do that I used a new custom field that I created with ACF plugin
2. Now we are going to put some code on your functions.php file.
// Define new columns
function cs_set_custom_columns($columns) {
$columns['product_season'] = __('Season', 'cs-text'); // Instewad of Season use your own value you want to show as a column title
return $columns;
}
add_filter( 'manage_product_posts_columns', 'cs_set_custom_columns');
// Show custom field in a new column
function cs_custom_column( $column, $post_id ) {
switch ( $column ) {
case 'product_season' : // This has to match to the defined column in function above
$get_season = get_field('season', $post_id);
echo $get_season;
break;
}
}
add_action( 'manage_product_posts_custom_column' , 'cs_custom_column', 10, 2 );
In the end, your product list should looks like this:
If you have any question feel free to ask in the comments.