Diferent color for hidden Woocommerce product in admin list

June 25th 2016
Woocommerce does not support filtering by product visibility. This option is very good for better vision in the product list. With a simple code you add the class to the product. Then with CSS create diferent background-color for product row.
Add this code to your functions.php file in theme folder.
//add class by visible options add_filter( 'post_class', 'add_my_class_to_post_list' ); function add_my_class_to_post_list( $classes ) { global $post; $classes[] = "product-is-".get_post_meta( get_the_ID(), '_visibility', true ) ; return $classes; } //add CSS to admin head add_action('admin_head', 'my_custom_css'); function my_custom_css() { echo '<style> tr.product-is-hidden { background: linear-gradient(white,red); } tr.product-is-search {} tr.product-is-catalog {} tr.product-is-visible {} </style>'; }
You can see, that in CSS code is more class, not just for hidden product. Becouse you can set four type of visibility in product options.