Resolution order
Six steps, in this order, and the sixth hands the page back to your theme.
This is the entire decision, and it is a walk down a list: the resolver takes the steps in turn and stops at the first one that can answer. Your shopper’s question goes through the same function whether they typed it into search or into the chat bubble — the difference is that the bubble wraps the result in a sentence a model wrote, and this block prints the result itself.
Step one
Is it a barcode?
Eight to fourteen digits, and digits alone: letters, spaces and dashes all send the query on to step two. That gets answered from a barcode index built alongside the catalogue, in a single lookup where a text search would scan. A theme reads titles and descriptions, so a shopper reading the number off the back of a bottle is the query this index exists for.
A number your catalogue carries is answered here, and any other number ends the walk at step one with the guess left unmade.
Step two
Is it a question about the shop?
Some searches ask about the shop itself. Color chart names a reference page, and so do questions about shipping, returns and how to use something. Your industry pack carries the patterns for those, and a match here ends the walk.
A product list would walk the shopper away from the thing they wanted, so the block offers to put the question to the assistant.
Step three
Does the catalogue match it as typed?
Every word has to appear somewhere in the product: its title, its series, an active ingredient, the short summary, or the handle. A product that misses one of the words drops out, because loose matching produces a list the shopper has to sift.
Accents and Turkish letters are folded before matching, so two spellings of the same word land on the same product.
Step four
Does it match after a synonym?
Reached when step three came back empty. A table in your industry pack maps the word the shopper used onto the word your titles use — mascarilla and ceras de cabello onto mask and wax, Conditoner onto the spelling you actually wrote — and the search runs again.
When that is what happened, the block says so above the results. Nobody should have to wonder whether they searched for something else.
Step five
Does it match if sold-out products count?
The last attempt in the walk. The same search runs once more with sold-out products included. If one turns up, the answer is that product named, plus alternatives from the same series and the same step of the routine.
Alternatives are drawn from your own catalogue by shared purpose, and every one of them is a product a shopper can buy today.
Step six
Nothing.
When all five have been tried, the block leaves its container empty. Your theme’s own empty state is what the shopper reads, unchanged, because a heading over an empty list reads as a broken section.
This is the step the whole order exists to avoid, and it is the only honest answer left when a word is in nobody’s catalogue.
Two details about step three, because they decide what a shopper sees first. A word found in the product title counts for more than the same word found in the handle, in a fixed order that is the same in every store: title, then series, then active ingredient, then summary, then handle. And when two products come out level, the cheaper one is listed first — a deliberate choice, applied the same way everywhere.