Access returned query suggestions from predictive_search object

Access returned query suggestions from predictive_search object

husseiny
Shopify Partner
9 0 3

The shopify documentation shows that it is possible to request for suggested query terms along with products and collections when performing predictive search.

Screen Shot 2023-05-04 at 1.03.09 PM.png

Screen Shot 2023-05-04 at 1.04.02 PM.png

but when i go to the developer documentation to actually implement it, there is no mention of the "query" option in the returned predictive_search_resources object. so i don't find any actually practical solution to this.

 

any help would be appreciated!

Thank you!

Replies 2 (2)

snapexyz
Shopify Partner
4 0 1

Several months later and still no mention in the docs. 

 

Did you manage to solve this in the end Husseiny?

mortal_wombat
Shopify Partner
1 0 1

Found an example of the returned query object in the documentation.

 

{
  "url": STRING e.g, "/search?_pos=1&_psq=cos&_ss=e&_v=1.0&q=costume",
  "text":STRING,
  "styled_text": STRING e.g, "<mark>cos</mark><span>tume</span>",
}

 

They're nested in the returned predictive_search object and accessible via: 

 

predictive_search.resources.queries

 

Hope that helps!