Find WooCommerce products with missing weight information

Having accurate product weight information is essential for the proper functioning of most shipping rate calculation plugins.

If a product is missing a weight value, it can cause shipping to be undercharged. In some circumstances, a product without weight information can’t be purchased at all.

Unfortunately, WooCommerce doesn’t provide an easy way to quickly identify all products that don’t have a weight, so I’ve put together this helpful little plugin. It finds all the weightless products in your store and prints them in a list.

Installation is easy: Just save the below code to a .php file and upload it to /wp-content/mu-plugins/, then No Product Weight should appear under Products in the WordPress dashboard. Check out ‘How to create a must use plugin‘ if you run into trouble.

You can also use the Code Snippets plugin to install the code, which is handy if you don’t have access to the filesystem.

* Plugin Name: Find Products Without Weight 
* Description: Adds a page that lists all products without weight information
* Author: Shane Gowland
* License: GPL
* License URI:
function register_missing_weight_checker_page() {
    add_submenu_page( 'edit.php?post_type=product', 'Missing Weight Information', 'No Product Weight', 'manage_options', 'missing_weight_classes_page', 'missing_weight_classes_page_callback' );
function missing_weight_classes_page_callback() {  ?>
<div class="wrap">
  <h1>Missing Weight Information</h1>
<p>The products listed below do not have weight information provided.</p>
$args = array(
    'post_type' => 'product',
    'posts_per_page' => -1,
    'post_status' => 'publish'
    $loop = new WP_Query( $args );
    global $post;
    global $product;
    //Count how many products were found so we can give zero-results feedback
    $products_found = 0;
    while ( $loop->have_posts() ) : $loop->the_post();
        $_product = wc_get_product($post->ID);
        $prod_weight = $_product->get_weight();
    if ( $_product->has_weight() == false ) {
        echo '<br /> '.get_the_title(). ' — <a target="_blank" href="' . get_edit_post_link($post->ID) . '">Edit Product</a>';   
        $products_found = $products_found + 1;

    //Output something if the number of results is zero
    if ($products_found == 0) {
        echo "No products were found.";
<?php }
add_action('admin_menu', 'register_missing_weight_checker_page',99);

Once all of the products have been found and corrected, you can remove the plugin. Or just leave it installed for next time!

1 thought on “Find WooCommerce products with missing weight information”

  1. Hi is there a way to edit this code to display products that are lets say over 5kg?
    i tried changing if ( $_product->has_weight() == false ) to if ( $_product->get_weight() >= 5 )
    But i got critical error. Thank you!


Leave a Reply