• Resolved 368ight

    (@368ight)


    Hello

    I want to Hide “No products were found matching your selection” on shop page.

    But if I use this code will be remove search product too.

    add_action( ‘woocommerce_product_query’, ‘prefix_custom_pre_get_posts_query’ );
    /**

    Even when I search for products, Regardless of whether there are matching products, they will not be displayed, there will be no prompt box, and no matching products will appear.

    I would like to ask if there is any way to delete only the prompt box on the shop page.

    Because I want to match woocomerce’s product wheels

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Feten L. a11n

    (@fetenlakhal)

    Hi there,

    Thanks for contacting us here at WooCommerce.com!

    Can you please send me a link to your shop page and a screenshot of what you would like to delete?

    Thanks!

    Thread Starter 368ight

    (@368ight)

    The code it’s this:

    remove_action( ‘woocommerce_no_products_found’, ‘wc_no_products_found’ );

    I was add to function.php file

    And that is the problem. When I search will show this.

    even that has the product.

    If I cancel the code it displays as usual but the problem front store page needs to display all items

    Because I don’t want all products to be displayed in the front desk, after I hide the products, it will show that no results can be found. If I add the code just now, it will affect the search function.

    Plugin Support Beauty of Code (woo-hc)

    (@beautyofcode)

    Hi @368ight ,

    I’m sorry, I am not sure I fully understand, the code you have shared is intended to exclude product categories from the shop page (in your case that’s earrings and rings), however, you have mentioned that your overall goal is to hide the “No products were found matching your selection” on the shop page:

    Please can you elaborate a bit more on what your overall end goal is here so that we can try and guide you effectively?

    Also, can you please share a link to your shop page so that we can take a closer look?

    Cheers!

    Thread Starter 368ight

    (@368ight)

    Sorry, just logged in to see the reply.

    I was actually trying to hide all products on the shop page because I have my own categories on the shop page.

    However, the code I used does hide all products, but the problem affects the search function.

    Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hi there @368ight,

    I understand you’re trying to hide all products on your shop page while maintaining the search function.

    To achieve this, you might want to try using a third-party plugin that allows you to manage product visibility without affecting the search function. Alternatively, you could modify your theme’s loop that displays the products on the shop page.

    It’s important to note that making changes to your theme’s code can have unintended consequences if not done correctly. If you’re not comfortable with this, I’d recommend hiring a developer, as this involves custom coding and implementations. The WooCommerce community is filled with talented open-source developers, and many of them are active on the channels listed below:

    Hope this helps!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hide “No products were found matching your selection” on shop page’ is closed to new replies.