Shopify themes, liquid, logos, and UX
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
1) Go to Online Store
2) Edit Code
3) Find en.default.json file
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!
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024