In WooCommerce, having a well-organized product catalog is essential for user experience and conversions. However, some store owners may forget to add featured images to products, leading to empty placeholders that can make the shop look incomplete or unprofessional.
If you want to ensure that only products with a featured image are displayed, you need a way to automatically hide those without one.
Instead of manually checking and updating each product, you can use a simple PHP snippet to exclude products missing a featured image from your shop, category, and search pages. This approach keeps your store looking polished while preventing customers from encountering blank product thumbnails. The best part? It only takes a few lines of code to implement.
Below, I’ll show you how to add this snippet to your themeโs functions.php file or a custom plugin, ensuring that only properly set up products appear in your WooCommerce store.

PHP Snippet: Exclude Products Missing a Featured Image @ WooCommerce Shop Page / Category Page / Search Results / Archives
This PHP code automatically hides WooCommerce products that lack a featured image from standard shop and category pages.
It achieves this by hooking a custom function (bbloomer_hide_products_no_feat_image) into WooCommerce’s main product query process (woocommerce_product_query action).
This function intercepts the query before it runs and modifies its parameters. Specifically, it adds a meta_query condition requiring that the _thumbnail_id meta key (which stores the ID of the featured image) must exist for a product to be included in the results.
This effectively filters out any product without an assigned featured image from the default product listings.
/**
* @snippet Hide Products Without Featured Image @ WooCommerce Shop
* @tutorial https://businessbloomer.com/woocommerce-customization
* @author Rodolfo Melogli, Business Bloomer
* @compatible WooCommerce 9
* @community https://businessbloomer.com/club/
*/
add_action( 'woocommerce_product_query', 'bbloomer_hide_products_no_feat_image' );
function bbloomer_hide_products_no_feat_image( $query ) {
$meta_query = $query->get( 'meta_query' );
$meta_query[] = [
'key' => '_thumbnail_id',
'compare' => 'EXISTS',
];
$query->set( 'meta_query', $meta_query );
}