Hello,
I'm using WC product categories and have this :
Cat1
Subcat1
Subcat2
Subcat3
Cat2
Subcat4
Subcat5
I have a Views thta dosplays products and want this view to make the following :
1. Display only Cat1products
2. Have a parametric search able to propose to filter by subcategories (only those under cat1).
The Views is located ona page.
I tried to use the parametric search but can only have Cat1 products or all products with the parametric search on all categories.
Can you help on this please
Thanks
Pat
This is not possible at the moment.
I filed such a feature request in past, but can not yet state an ETA or even if it's considered or not.
Views Parametric Filters for Taxonomies will always produce all Terms in the Filter.
What you can try is to use a second Taxonomy, which acts sort as a "child term" taxonomy.
You categorise your Products by "Taxonomy A" (parent) and also by Taxonomy B (that acts as child)
Then you create a View that lists Posts, with this Query Filter:
Select posts with taxonomy: your_taxonomy set by the parent Taxonomy View
</Code
Also, you insert a Parametric Filter, that filters your second Taxonomy B, (which acts as child)
Then you create a second View, a taxonomy View, that queries only Taxonomy A and has a query filter as:
[php]
Taxonomy is One of these: your_term
You will then insert the first view to this taxonomy View's Loop and insert the taxonomy View to a page.
Hi Beda,
Do you mean that I need to create another taxonomy than "Product cat" ?
I was thinking that arranging the categories like explained in my previews post (cat and subcat) would be sufficient to make the sorting only on subcat.
Not sure to understand your solution. Could you clarify please.
Thanks
Pat
Let me clarify.
1. Views will, when you insert a parametric Search by your Taxonomy, always generate a Search Filter by ALL terms (parents and children terms)
You can see a typical output in my screenshot.
2. If you need a Front End Filter like in my ScreenShot that does dispaly ONLY terms that are Child of a given parent, it is not possible, becuase the View will allow the Taxonomy filter only ONCE each View.
And therefore, you need 2 Taxonomies, one acts as a parent to the other.
Or you could neglect to use a Paramteric Search and isntead return Posts, in a Taxonomy View, which query Filter is set to "Select taxonomy terms whose parent is your_parent_term".
But this will not allow a Paramtric Search, as only Post Views do allow Paramtric Searches.
This is why I suggested to create 2 Taxonomies, one acts as parent to the other.
I am not sure I understand your goal, as you mentioned earlier, you want to
1. Display only Cat1products
2. Have a parametric search able to propose to filter by subcategories (only those under cat1).
Now in the last answer you mention that you want it to SORT by those terms
This is not the same.
To sort by Terms, you needto use the Ordering Setting in the View.
But only Taxonomy Views can be ordered by Taxonomy terms.
Not so Post Views.
Again you would need at least 2 Views and nest them
Here is some DOC about this:
https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/
Hi Beda,
Thanks for your clarification.
I have managed this with an additional custom field to define the sub category ad it's working.
Regards
Pat