Hi there Harry,
By default, WooCommerce should exclude any hidden products from the shop page and search results, as long as the setting shown in the image below is set:

Link to image: https://d.pr/i/IURjpv
If your hidden products are showing up on the frontend of the site, then that is most likely being caused by code in a custom theme, or possibly another active plugin on the site.
To narrow down what is causing the hidden products to be displayed, please temporarily switch your theme back to Storefront and disable all plugins except for WooCommerce, then check to see if the issue is fixed. If it is, then you can switch your theme back and reactivate plugins one-by-one until you find the one that is causing the issue.
You can read about testing for conflicts in our documentation here:
https://docs.woocommerce.com/document/how-to-test-for-conflicts/
I hope that helps!
I know that but I want t display them somewhere custom and I need a custom query Ifor it. Is there a way because I couldn’t find one yet.
Thanks in advance!
-
This reply was modified 6 years, 2 months ago by
harryf98.
Hi there,
For a custom query, you could use the wc_get_products function that is described here:
https://github.com/woocommerce/woocommerce/wiki/wc_get_products-and-WC_Product_Query
You can read about the visibility parameter in this section
So, you should be able to use the following to retrieve all visible products.
$args = array(
'visibility' => 'visible',
);
$products = wc_get_products( $args );
I hope that helps!
Hi there,
We haven’t heard back from you in a while, so I’m going to mark this thread as resolved. If you have any further questions, please start a new thread.
Have a wonderful day!