How to Hide WooCommerce Products Without Image?

In today’s article, I’ll explain the step-by-step process of hiding WooCommerce products without images. Many guides are available online to help you, but you will need to use the custom code to get the final results. 

It can be difficult for you if you have no coding experience. Don’t worry. I got you here!

I’ll use the WooCommerce Restriction Rules plugin to hide the WooCommerce products without images. You won’t need to use any custom code to do so. You can follow this simple tutorial to get the results you want. 

Before diving into the tutorial, let’s look at one of the scenarios in which you will need to hide the products without an image. 

Why Would You Want to Hide the WooCommerce Products Without Image?

You might have heard the quote ‘A picture is worth a thousand words,’ so you don’t want to show the products without the images to your customers because it can leave a wrong impression on your store.

Let’s say you are a wholesale seller, and you got a product sheet from your manufacturer that you can import to WooCommerce for adding bulk products to WooCommerce in a few clicks. 

That sheet may have some products without images; if the sheet has a large number of products and many products are missing the product images, uploading the images for each product might be time-consuming. 

So you only want to hide the products without images until you upload all the images. This way, your users won’t be disturbed and can only see the products that have the images. 

How to Hide WooCommerce Products Without Image?

Follow the following steps to hide the WooCommerce products without images. 

1. Install and Activate the WooCommerce Restriction Rules Plugin

Note: You can skip this step if you have installed and activated the WooCommerce Restriction Rules plugin. 

To install the WooCommerce Restriction Rules plugin, you will need to install the Woosuite Core plugin and activate it with the help of a license key. We have created a Quick Start Guide for you to figure out how to install and activate the WooCommerce Restriction Rules plugin.

2. Navigate to Restriction Rules

Once you have installed and activated the plugin, navigate to the Woosuite » Restriction Rules from your WordPress dashboard.

3. Navigate to the Hide Product Rules Tab

We need to add restrictions to some products, so the products without the featured image are hidden from the customers. 

Expand the Hide Product Rules tab by clicking the (▾) from the plugin’s settings. 

In this tab, you’ll see a few options that will help you add product restrictions. 

4. Hide the Products Without Images

Once in the product rule settings, enable the ‘Excluding products without featured image’ option by clicking the button next to the text. 

5. Bonus: Hide Specific Products Without the Image (Optional)

If you want to hide products without the image from a specific category, then from the “Filter By” field, select the “Category from which you want to hide the products that are without the image. You can filter products by: 

  • Category
  • Tags
  • Products

Once you select any filter, you’ll see a new field below it from where you can select the category or whatever you choose from the ‘Filter by’ dropdown above. 

You can add multiple rules by clicking the ‘Add New Rule’ button. But remember, if you add the same category or use the same user role in two or more rules, only the first one will be applied. 

5. Save the Changes

Once you have created the rule, click the “Save Changes” button at the top right corner of your screen to save all the settings. 

6. Final Results

Now let’s test the rule. 

To test it, I first visited the shop page without adding the rule, and as you can see in the screenshot below, there is a product with no image. 

So we can add images to the product, but if the pictures take a long to make, we can simply hide the products without the image from the shop page

This will help you present a friendly, clean shop page to the customers. 

So, I added the rule and revisited the shop page. This time, as you can see in the screenshot below, there are no products without a featured image.

Alternatively, you can try this code:

add_action( 'woocommerce_product_query', 'custom_pre_get_posts_query' );
function custom_pre_get_posts_query( $query ) {
    $query->set( 'meta_query', array( array(
       'key' => '_thumbnail_id',
       'value' => '0',
       'compare' => '>'
    )));
}

Wrapping Up

So that’s it for today’s tutorial. 

Now you know how to hide WooCommerce products without images without using custom code. 

The WooCommerce Restriction Rules plugin can help you in several ways. For example, it can help you create a members-only store, restrict product purchase, and more. 

Also, if you have any queries, you can ask them in the comments or contact our customer support. Our dedicated customer support team typically replies within 48 hours.
Ready to get started? Download the WooCommerce Restriction Rules plugin today!

Brian
Brian

Welcome to the AovUp blog, where we discuss all things WooCommerce. I hope we can help you achieve something today...

Leave a Reply

Your email address will not be published. Required fields are marked *

We – and our partners – use cookies to deliver our services and to show you ads. By using our website, you agree to the use of cookies as described in our Cookie Policy