Custom Search Bar To Search ONLY Within A Specific Collection, And/Or Exclude Certain Collections?

Hello,

I’m trying to separate certain products either by collection or by tags, so that I can have search bars for different products.

I’m trying to have a search bar that ONLY searches within a group of specific products, and would not return any products that aren’t within a specific collection or have a specific tag.

Then I might like to have another search bar that EXCLUDES a collection of products, so those don’t get mingled into a general search.

For example: A collection of Used T-Shirts in a general clothing store. If a user navigates to the Used T-Shirts page and performs a search, I’d only want search results within that Used T-Shirts collection (and not include any items in the general collection).

Similarly, if someone is browsing the general listing of clothes and performs a search, I’d like that to EXCLUDE anything in the Used T-Shirts section.

Does anyone know if this is easily achieved, through custom code in the Search Form? Or any other way?

Thank you!!

Gene

1 Like

Hi @gs3 ,

Currently, Shopify theme does not support this. You can change to search by type instead of collection, it will be almost what you want. Refer https://themes.shopify.com/themes/warehouse/styles/metal?price%5B%5D=paid&surface_inter_position=1&surface_intra_position=13&surface_type=all

Refer code:


But it will require you to have coding experience, for newbies I recommend you to install the app:

https://apps.shopify.com/searchanise or https://apps.shopify.com/search?q=Smart%20Search

Hope it helps!

It’s totally possible to show the search bar for just some collections and exclude some products from your collections based on rules using this app https://apps.shopify.com/ultimate-search-and-filter-1.

You can create rules to exclude products from specific collections by going to Collections => Merchandising rules. To show the search bar for specific collection, ask the team in Live chat.