Here’s an example from a different Theme where it suffices to add
Shopify.routes.root +
in front of the search query generating code inside the theme.js file.
Before:
this.getSearchQuery = () => {
return `/search/suggest.json?q=${this.searchInput.value}&resources[limit]=3&resources[limit_scope]=each`;
};
this.getSearchPageUrlWithQuery = () => {
return `/search?q=${encodeURIComponent(this.searchInput.value)}*`;
};
After:
this.getSearchQuery = () => {
return **Shopify.routes.root +** `search/suggest.json?q=${this.searchInput.value}&resources[limit]=3&resources[limit_scope]=each`;
};
this.getSearchPageUrlWithQuery = () => {
return **Shopify.routes.root +** `search?q=${encodeURIComponent(this.searchInput.value)}*`;
};