How can I increase the number of products in predictive search dropdown?

Hello,

I have used wrhuse theme and in this theme there is a search feature name predictive search. When I search product it shows only 3 in the dropdown but there are many products, I have checked code file but couldn’t get the solution to increase the number of products show in dropdown.
Can anyone help me in this how to increase predictive search size from 3 to 10?

Here is the code line
{{ predictive_search.resources.products.size }} ---- Output : 3

Thank you in advance.

I don’t think that code is end point to result. That code just count the number items after the resources object handled.

The result will regarding to resources[limit]. So you need check code and find to the script code handled resources, then replace the number you want to get total items here. I guess the theme you are using have support to setup total items show for search predictive part.

You can also referent the shopify’s docs here: https://shopify.dev/docs/api/ajax/reference/predictive-search

Hello @DitalTek ,

Thank you for your help and it is working.
I have assigned resources[options][fields]=variants.sku in script and it is working fine with SKU search but when I use title it is not working.
Can you please help me here how to use both fields in search ?

Here is the Line of code.

queries = [
fetch(
“”
.concat(url, “?section_id=predictive-search&q=”)
.concat(
productQuery,
“&resources[limit]=5&resources[limit_scope]=each&resources[options][fields]=variants.sku&resources[options][fields]=title”
),
queryOptions
),
];

Hi,

you can replace the code above as like this:

queries = [
fetch(
""
.concat(url, "?section_id=predictive-search&q=")
.concat(
productQuery,
"&resources[limit]=5&resources[limit_scope]=each&resources[options][fields]=title,variants.sku"
),
queryOptions
),
];
1 Like

In which file, did you make this change. I have been going through Shopify files but am not able to figure it out.

I found the code at assets/theme.js and searched ‘&resources’