Support » Plugin: WooCommerce » Product dimension (weight) column in admin

  • Hi there,

    How to add product dimension (weight) column in woo admin?
    My shipping methods are based on product weight and it would be very useful to know which one is missing. I understand that to display weight of products with variation may be difficult. Any idea?

    Thanks!

    https://wordpress.org/plugins/woocommerce/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Use the manage_product_posts_columns and manage_product_posts_custom_column hooks.

    Something like this should do the trick:

    add_filter('manage_product_posts_columns', 'my_manage_product_posts_columns', 10);
    add_action('manage_product_posts_custom_column', 'my_manage_product_posts_custom_column', 10, 2);
    
    function my_manage_product_posts_columns($defaults) {
        $defaults['weight'] = 'Weight';
        return $defaults;
    }
    function my_manage_product_posts_custom_column($column_name, $post_ID) {
        if ($column_name == 'weight') {
            $p = new WC_Product($post_ID);
            echo $p->get_weight();
        }
    }
    Thread Starter MTD

    (@espider)

    Hi Ralbatross,

    Indeed, it works great!
    Thanks a lot for it.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Product dimension (weight) column in admin’ is closed to new replies.