Add Products Table Column in Woocommerce Admin

The default WooCommerce Dashboard Products page shows the list of products in a table. Default fields are: Image, SKU, Stock, Price, Categories, Tags, Featured and Date. Sometimes, these columns are not enough and you need more. To do so you can simply add this following snippet to your functions.php

/**
 * @snippet       New Products Table Column on WooCommerce Admin
 * @author        codeithub
 */
 
add_filter( 'manage_edit-product_columns', 'codeithub_admin_products_visibility_column', 9999 );
 
function codeithub_admin_products_visibility_column( $columns ){
   $columns['visibility'] = 'Visibility';
   return $columns;
}
 
add_action( 'manage_product_posts_custom_column', 'codeithub_admin_products_visibility_column_content', 10, 2 );
 
function codeithub_admin_products_visibility_column_content( $column, $product_id ){
    if ( $column == 'visibility' ) {
        $product = wc_get_product( $product_id );
      echo $product->get_catalog_visibility();
    }
}

Before:

See also  Delete Woocommerce Images After Deleting a Product
Default Woocommerce Product List

After:

Additional Column in Product table

Leave a Reply

Your email address will not be published. Required fields are marked *