add_action( 'admin_notices', 'bbloomer_products_no_weight_admin' ); function bbloomer_products_no_weight_admin(){ global $pagenow, $typenow; if ( 'edit.php' === $pagenow && 'product' === $typenow ) { echo '<div class="notice notice-warning is-dismissible"><h3>Products with no weight</h3><ul>'; $args = array( 'status' => 'publish', 'visibility' => 'visible', 'limit' => -1 ); $products = wc_get_products( $args ); foreach ( $products as $product ) { if ( ! $product->get_weight() ) { echo '<li><a href="' . esc_url( get_edit_post_link( $product->get_id() ) ) . '">' . $product->get_name() . '</a></li>'; } } echo '</ul></div>'; } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter