Home / Admin / Add column Product type in WooCommerce
Duplicate Snippet

Embed Snippet on Your Site

Add column Product type in WooCommerce

Add a column in the product list to differentiate the type of product

Code Preview
php
<?php
// Add column: Product type
add_filter( 'manage_edit-product_columns', 'huk_admin_products_visibility_column');
 
function huk_admin_products_visibility_column( $columns ){
   $columns['product_type'] = 'Type';
   return $columns;
}
add_action( 'manage_product_posts_custom_column', 'huk_admin_products_visibility_column_content', 20, 2 );
 
function huk_admin_products_visibility_column_content( $column, $product_id ){
    if ( $column == 'product_type' ) {
        $product = wc_get_product( $product_id );
        $product_type = $product->get_type();
        echo ucfirst( $product_type );
    }
}

Comments

Add a Comment