Search Results Filters Overview
Advanced Woo Search PRO includes a built-in feature to create search result filters based on various parameters.
For example, you can filter WooCommerce product search results by product category, tag, visibility, attribute, stock status, and more.
You can create separate filters for all available result types: products, archive pages, and users.
Each type has its own set of available filtering parameters.
Additionally, you can combine these filters into AND/OR
logical groups, allowing for the creation of complex search logic.
Example: Display only products in the search results with categories Hoodies
OR Accessories
, OR, if the current user is logged in, show all products instead.
As demonstrated, search result filters provide significant opportunities to create varied and precise filters for search results.
Starting from plugin version 3.14, even more filtering parameters are available.
You can now create filters based on the current page, the current user's device, and the current search term. These parameters are global, meaning they can be applied to all search result types.
Filter Results by Current Page
Filter the search results based on the page where the user is performing the search.
This filtering type includes several different parameters: current page name, current page template, current page type, and current page archives.
With these filters, you can create interesting filtering rules. You can show or hide products for specific pages, page types (e.g., single product, shop page, cart page), or archive pages (e.g., categories, tags, attributes).
How to Create a Filter Based on Current Page
Creating such filters is straightforward and requires only a few steps:
1. Install and activate the Advanced Woo Search PRO plugin. Ensure you have at least version 3.14.
2. Go to the plugin settings page -> Search Results tab and scroll down to the Filter Results section.
3. Create a new filter for any of the search result types: product, taxonomy archive page, or user.
4. Choose the filter type from the Current Page section that best suits your needs. For example, let’s create a filter to completely hide search results on the page named Sample Page
and show them on all other pages.
Such a filter might look like this:
Current page -> equal to -> Sample page AND
Product -> not equal to -> Any product
OR
Current page -> not equal to -> Sample page AND
Product -> equal to -> Any product
5. Save all changes and check your search form. If the form is placed inside the Sample page
, no search results will be shown.
Examples
Example 1: If the user is on the T-shirt
category page -> show results only from this category. Otherwise, show products from all categories.
Note: We covered how to create search filters based on current taxonomy in this article.
Example 2: If the user is on the cart page
-> show only products that have been added to the user's cart. In this case, we created a search form exclusively for In Cart
products, simplifying navigation for these product.
Filter Results by Current Search Text
This is the most interesting search result filter. It allows you to create filters based on the current search text.
For text comparison, you can use operators such as equal to
, not equal to
, contains
, and not contain
.
This filter is incredibly powerful for creating advanced search functionalities. You can build a virtual assistant-type system based solely on this rule.
For example, if the user's search query contains the word popular
- show only top-selling products.
If the user's search query contains the words sale
and hoodie
- show products from the Hoodie category that are on sale.
And so on. The possible use cases are limited only by your imagination.
How to Create a Filter Based on Current Search Text
Creating filtering rules based on the current search text is similar to creating filters for other parameters.
1. Install and activate the Advanced Woo Search PRO plugin. You need at least version 3.14.
2. Go to the plugin settings page -> Search Results tab and scroll down to the Filter Results section.
3. Create a new filter for any of the search result types: product, taxonomy archive page, or user.
4. Let’s create a filter for product search results. For example, set the following rules:
Current search text -> contains -> sale AND
Product is on sale -> equal to -> Yes
OR
Current search text -> not contains -> sale AND
Product -> equal to -> Any
This will show only On Sale
products if the user's search text contains the word sale
.
Examples
Example 1: If the user's search query contains the word Featured
- show only featured products.
This way, we can promote all our featured products and enhance the user experience.
[screen - Show only featured products if the search query contains the word 'Featured']
Example 2: If the user's search query contains the word Hoodie
- show only products from the Hoodies category. You can create filters for any other category in the same way: Shoes, T-shirts, Hats, etc.
Example 3: If the user's search query contains the words size
and medium
- show only products with the attribute Size equal to Medium. You can create similar filters for any other sizes.
Filter Results by the User's Current Device
With these new search result filters, you can show or hide results based on the user's current device: mobile or desktop.
Examples
For example, you can hide products from a specific category in search results if the user is viewing your shop from a mobile device.
Comments