Integrate predictive search #2462
Unanswered
patrick-schneider-latori
asked this question in
Help
Replies: 1 comment
-
Have you tried creating an API route that encapsulates the call to the predictive search Ajax endpoint? It will add latency, since you're making two network hops instead of one, but might be good enough. CORS shouldn't be an issue if the request is made server-to-server. I'm not sure that predictive search functionality has been implemented in the storefront API yet, so you could risk trying to fit a square peg in a round hole 🤷🏻♂️ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Since the use of the suggestions endpoint (https://shopify.dev/api/ajax/reference/predictive-search) is not do-able with a separate Hydrogen storefront (having CORS issues): has anyone any idea how to implement something similar, maybe with a "classic" search via Storefront API (query parameter -> https://shopify.dev/api/storefront/2023-01/objects/Product#query-products)? And how should we use it with todays utilities and hooks? Should we create a separate API route and fetch e.g. suggested products with useShopQuery? Or make a direct call to the Storefront API – but with fetchSync?
Thanks to all contributors to this open discussion.
Beta Was this translation helpful? Give feedback.
All reactions