Skip Navigation

[Resolved] Custom search/filter only certain product categories?

This thread is resolved. Here is a description of the problem and solution.

Problem:
how to exclude specific taxonomy term from search result

Solution:
If you do not added category search filter, you will just require to add the taxonomy filter and select the option "NOT one of the following" and select the category you want to exclude from search.

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/custom-search-filter-only-certain-product-categories/#post-1770021

Relevant Documentation:
=> https://toolset.com/documentation/user-guides/views/filtering-views-by-taxonomy/

This support ticket is created 4 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 6 replies, has 2 voices.

Last updated by charleneK 4 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#1768489

Tell us what you are trying to do?

I'm trying to create a custom woocommerce product search that only searches within certain categories.

Is there any documentation that you are following?

hidden link

I can easily create a search form with views to create a custom search to search all products, but I'm wondering how to go about excluding or only listing results in certain catagories. such as: right now say I have 4 categories...... one, two, three and four. I only want to show results if they are in category one and two. possible? if so how......

thanks much+++

#1769133

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I would like to know first - do you mean that you want to pre-filter the view results before it get displayed.

Having said that - do you mean that when the view displayed first time, you want to display only products belongs to category one and two?

#1769621

Basically, I have the search form on page 1, so no initial view results are displayed, it only displays the form on that page. Users search for items in the store and are directed to the results page.

I am just looking for how to exclude results from certain categories in the results. So for example, if I have 3 categories.....one, two and three, I only want items from categories one and two to show up on the results page.

So in category

one -- (shirt, shirt 1, shirt 2)
two -- (shirt 4, shirt 5, shirt 6)
three -- (shirt 7, shirt 8, shirt 9)

If I am only including results from categories one and two in the results, if the user searches for "shirt" the only results that would show up on the results page would be (shirt,shirt 1, shirt 2, shirt 4,shirt 5, shirt 6)

(shirt 7, shirt 8, shirt 9) would not show up on the list of results.

hope that explanation makes more sense++ 🙂 thanks much++

#1770021

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes - its possible.

As I understand - you have added the text search to your search form - correct? if yes, do you have only text search with your search form or you have added category search filter as well.

If you do not added category search filter, you will just require to add the taxonomy filter:
=> https://toolset.com/documentation/user-guides/views/filtering-views-by-taxonomy/

And select the option "NOT one of the following" and select the category you want to exclude from search.

Please let me know if that helps.

#1772651

When I choose " Display the results using a custom search" when creating the view, on the resulting view edit page "Query filter" is not an option to set.

#1773021

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please click on "Screen Options" button available at top right corner of your edit view page and activate the "Query Filter" checkbox, then you will be able to see the "Query Filter" section on your edit view page.

#1773505

Perfect++ thanks much, that did it++