WordPress · WooCommerce

Live Search for WooCommerce

Live search shows matching products in a dropdown under your search box while the customer is still typing. The suggestions are produced by your own WordPress, through the WooCommerce Store API, and never reach the Queryra API. That is why live search works on every plan, including the free one, needs no API key, and does not count toward your monthly searches.

Turning it on

Live search is off until you switch it on, so installing or updating the plugin changes nothing on your storefront by itself.

In WP Admin: Queryra → Live Search

If your site caches pages

A page cache serves visitors a copy of your storefront that was built before you changed the setting. After switching live search on or off, clear the whole cache, not just the page you are looking at. WP Super Cache, WP Rocket and LiteSpeed Cache all have a purge-everything button. We ran into this on our own demo store: the setting was right, the dropdown was live for us as a logged-in editor, and visitors kept getting the old page.

What a suggestion shows

Product name
matched against the product name and the SKU
Product image
the WooCommerce product image, where the product has one
Price
as WooCommerce formats it for your store

The words can come in any order. Typing gel cocolo finds Cocolo Shower Gel, because every word is matched on its own against the product name and the SKU instead of as one phrase.

This first version suggests WooCommerce products only. Posts, pages and custom post types do not appear in the dropdown yet, although AI search still finds them once the customer submits the query.

The last row: Search with AI

Search with AI: something warm for winter

The bottom row of the dropdown hands the query to Queryra. Picking it runs an ordinary AI search, which does count toward your monthly searches, exactly like a search submitted from the search box. It is shown only when an API key is connected and AI search is working, so a store with no key, or one whose allowance is spent, simply does not see that row.

When nothing in your catalogue matches what the customer has typed, the AI row moves to the top. That is the case where names and SKUs have nothing to offer and meaning is the only thing left to search by.

The texts in the dropdown

Three lines can be changed under WP Admin → Queryra → Live Search: the row that hands the query to AI search, the row shown when AI search is not available, and the line that appears when nothing matched, No products matched.

In all three, %s stands for what the customer has typed, so Search with AI: %s reaches the shopper as Search with AI: something warm for winter.

Why this is not search as you type for the AI

We have long advised against letting a theme fire AI searches on every keystroke: the AI gets telev instead of a finished thought, and every fragment costs a search. Live search does not do that. Every keystroke is answered by your own store, by name and SKU. The AI is asked once, by the customer, when they choose the last row or submit the form.

Two things to check in your theme

No search field on the page

Some themes, block themes in particular, have no search field on the storefront at all. Add one where you want it with the shortcode [queryra_search], and live search attaches to that field.

The theme already has its own suggestions

Many commercial themes ship a dropdown of their own under the header search box. If yours does, leave Queryra live search off rather than putting two dropdowns on one field.

If SKU matches look wrong

SKU matching uses WooCommerce's own product lookup tables. Those tables are maintained by WooCommerce, not by Queryra, and they can fall behind after a bulk import, a migration or a mass edit. Rebuilding them is a standard WooCommerce maintenance task:

In WP Admin: WooCommerce → Status → Tools → Regenerate product lookup tables

Appearance

The dropdown is styled with plain CSS, and the class names below are fixed. There are no CSS variables to set: you restyle it by overriding rules on these classes, from Appearance → Customize → Additional CSS or from your theme stylesheet. Treat the names as a contract, because changing one would break somebody's CSS.

Start every rule with body

The plugin's stylesheet loads when the visitor first touches the search field, which puts it after your Additional CSS in the document. A plain class selector therefore loses to ours. One extra word settles it:

/* ignored, our 13px wins */
.queryra-ls__price { font-size: 20px }
/* applied */
body .queryra-ls__price { font-size: 22px }

The panel is also a child of body, not of your header, so a theme rule scoped to something like .site-header .results never reaches it.

The dropdown

.queryra-ls
the whole panel: border, background, shadow, scrolling, position
.queryra-ls__list
the list itself (a ul with role="listbox")
.queryra-ls__item
one row (an li with role="option")
.queryra-ls__item--all
the last row, Search or Search with AI
.queryra-ls__item.is-active
the row picked with the arrow keys, which is not :hover
.queryra-ls__link
the link filling the row, at least 44px tall
.queryra-ls__link--all
the link in the last row
.queryra-ls__thumb
the thumbnail, a fixed 40 by 40 box
.queryra-ls__text
the column holding the name and the price
.queryra-ls__name
the product name; the matched fragment is wrapped in <mark>
.queryra-ls__price
the price line
.queryra-ls__none
the "No products matched" row
.queryra-ls__status
a message for screen readers, hidden on purpose

Leave .queryra-ls__status alone. It sits outside the panel and is invisible by design: a screen reader reads the number of results from it, so making it visible prints that line twice.

The field from the shortcode

.queryra-search-form
the form (GET, role="search")
.queryra-search-field
the text input; its font-size is 16px
.queryra-search-submit
the button; the plugin gives it no styles at all, so it is yours

The 16px on the input is deliberate. Below 16px, Safari on iPhone zooms the whole page in when the shopper taps the field, and it does not zoom back out. If you want a smaller font there, that is what you are buying.

What not to hook onto

Ids such as queryra-ls-1, queryra-ls-1-list and queryra-ls-1-opt-0 are generated per field and per page view. On a page with two search fields the numbers differ, so a selector built on an id works once and then stops. Style the classes.

Three that you can paste

Rounder corners and a deeper shadow

body .queryra-ls { border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
body .queryra-ls__link { padding: 10px 12px; }

The matched words in your own colours

body .queryra-ls__name mark { background: #fff3cd; color: inherit; font-weight: 600; }
body .queryra-ls__price { font-size: 14px; opacity: 1; }

A dark panel, for a dark theme

body .queryra-ls { background: #1d2327; color: #f0f0f1; border-color: rgba(255,255,255,.2); }
body .queryra-ls__item { border-bottom-color: rgba(255,255,255,.08); }
body .queryra-ls__item.is-active .queryra-ls__link { background: rgba(255,255,255,.08); }

The panel is always light, whatever the visitor's system is set to, because that is a preference of theirs and not a property of your shop. The browser's own suggestions behave the same way. A dark theme overrides it with the three rules above.

Related

Don't see your plugin or theme here?

Not sure it works with Queryra, or want us to verify compatibility? Get in touch — tell us the plugin or theme and we'll check, usually the same day.

WordPress Support Forum