[Resolved] Exclude Products from View if WooCommerce Catalog visibility is set to hidden
This thread is resolved. Here is a description of the problem and solution.
Problem:
Exclude Products from View if WooCommerce Catalog visibility is set to hidden - Filter product by Catalog/product visibility
Solution:
To filter the product by Catalog visibility equal to hidden, You should navigate to "Query Filter" section of your view and try to add a taxonomy filter for the taxonomy "Product visibility" there you should select the two options "exclude-from-catalog" And "exclude-from-search" and also make sure you select the option "All of the following".
Tell us what you are trying to do?
Using WooCommerce Views to show Views of Products and need to exclude hidden products based on the WooCommerce Catalog visibility setting of hidden.
Wondering if there is a way to do this with Toolset without needing custom code to filter the query args (I have several views where this needs to work and don't want to have to remember to add view ids to the filter anytime I create a new view in the future).
I'd really like to have WooCommerce Product Visibility available in the filter options for the View.
Is there any documentation that you are following?
Not really. I don't see anything in the documentation or Views filter options that appears to honor the visibility setting for a product.
Is there a similar example that we can see?
What is the link to your site? hidden link but there's nothing to see there.
You can see what I'm trying to accomplish on any WooCommerce site by changing a product's WooCommerce catalog visibility to hidden then using a View to list products from a category that product is in. The product will show.
We are creating some grouped products where we don't want the underlying linked products to show in our Views for categories and custom taxonomies so the customer can simply find the grouped products and choose quantities of the linked products from those without having to decide whether to click the grouped product or one of several linked products from the View.
Hello. Thank you for contacting the Toolset support.
Can you please navigate to:
Toolset => Settings => Front-end Content tab => Hidden custom fields section => Click on button "Select custom fields" and try to find and checkmark the checkbox option with "_visibility" and "Apply" the settings.
Then Edit your view and navigate to "Query Filter" section and click on button "Add a filter" and add the filter for the "_visibility" and set its value to "hidden".
I hope the above solution shared with you will help you to resolve your issue.
Hi Minesh, _visibility isn't in the list of hidden fields I can check when I go to Toolset -> Settings -> Front-End Content -> Select Hidden Fields.
I think WooCommerce stores this value in the serialized attributes postmeta as is_visible:
a:1:{s:4:"size";a:6:{s:4:"name";s:4:"Size";s:5:"value";s:68:"Cube 4x4x4 inch | Regulation 9x5x5 inch | Jumbo Standard 10x7x4 inch";s:8:"position";i:0;s:10:"is_visible";i:1;s:12:"is_variation";i:1;s:11:"is_taxonomy";i:0;}}
So it is not something that we can easily use in a query filter, correct?
I suppose I could add my own separate field to use but then I'm back to the problem of having to apply it in not just all my views but also all standard WooCommerce archives that I wouldn't otherwise need to modify unless I remember to check my box AND set the item to hidden in the WooCommerce visibility setting. I worry about training the customer to create and edit their products properly with that much complexity.
I think WooCommerce stores this value in the serialized attributes postmeta as is_visible:
a:1:{s:4:"size";a:6:{s:4:"name";s:4:"Size";s:5:"value";s:68:"Cube 4x4x4 inch | Regulation 9x5x5 inch | Jumbo Standard 10x7x4 inch";s:8:"position";i:0;s:10:"is_visible";i:1;s:12:"is_variation";i:1;s:11:"is_taxonomy";i:0;}}
So it is not something that we can easily use in a query filter, correct?
==>
Yes - obviously thats correct, you can not set filter for the content that is stored in database as serialized array. So, thats not an option at all.
However - I've found another way.
What if you edit your view and navigate to "Query Filter" section and try to add a taxonomy filter for the taxononmy "Product visibility" there you should select the two options "exclude-from-catalog" And "exclude-from-search" and also make sure you select the option "All of the following" as per the following screenshot.
=> hidden link
That did it! I never thought to look in taxonomy filters as WooCommerce puts the visibility setting in the Publish settings area of the Product editing page, not down with the other taxonomies.
Thanks for finding and pointing out where Product Visibility can be used as a filter.