Hey All
I’m using the search bar on the Dawn theme to search pages, but the suggestions/results show in a random order. Does anyone know how to sort them alphabetically? Thanks in advance ![]()
LINK TO PREVIEW (We are working on an unpublish theme)
Hey All
I’m using the search bar on the Dawn theme to search pages, but the suggestions/results show in a random order. Does anyone know how to sort them alphabetically? Thanks in advance ![]()
LINK TO PREVIEW (We are working on an unpublish theme)
Hello, @teoias
fetch('/search/suggest.json?q=' + query + '&resources[type]=product')
.then((response) => response.json())
.then((data) => {
let results = data.resources.results.products;
// Sort results alphabetically by title
results.sort((a, b) => a.title.localeCompare(b.title));
renderSearchResults(results); // Function to display sorted results
});
Thanks!
off sitewide
July sale — 45% off at checkout, applied automatically. Valid for 60 minutes. One per customer.
Offer ends in