Title: evertech's Replies | WordPress.org

---

# evertech

  [  ](https://wordpress.org/support/users/evertech/)

 *   [Profile](https://wordpress.org/support/users/evertech/)
 *   [Topics Started](https://wordpress.org/support/users/evertech/topics/)
 *   [Replies Created](https://wordpress.org/support/users/evertech/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/evertech/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/evertech/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/evertech/engagements/)
 *   [Favorites](https://wordpress.org/support/users/evertech/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] Highlight out of stock products in admin panel](https://wordpress.org/support/topic/highlight-out-of-stock-products-in-admin-panel/)
 *  Thread Starter [evertech](https://wordpress.org/support/users/evertech/)
 * (@evertech)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/highlight-out-of-stock-products-in-admin-panel/#post-13711593)
 * Thank Rodrigo, that did it!
    In case anyone needs to did something similar, here’s
   the code I used:
 *     ```
       add_filter('post_class', 'set_row_post_class', 10,3);
       function set_row_post_class($classes, $class, $post_id){
   
           // Make sure you're in the admin panel
           if (!is_admin()) {  
               return $classes;
           }
   
           // limit action to product table
           $screen = get_current_screen(); 
           if ('product' != $screen->post_type && 'edit' != $screen->base) {
               return $classes;
           }
   
           // Get stock status of the product 
           $stock = get_post_meta( $post_id, '_stock_status', true );
   
           // Add a class to the <tr> with the stock status
           $classes[] = "stock-status-".$stock;
   
           // Return the array with the classes
           return $classes;
       }
       ```
   
 * Cheers
    Roberto

Viewing 1 replies (of 1 total)