Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I want to be able to search by SKU on our stores search without the use of an app, however I am struggling on what code to implement and where since it doesn't exist by default in our theme's predictive search. We are using the Fetch theme by Archetype.
Any help would be appreciated,
Hi
Search can only be performed on product title and description however, you can trick the search by putting your SKUs in the product description.
Hope this trick will help...
Were you able to figure this out? I actually have the same theme and want to do the same thing. Let me know, thanks!
When I enter a SKU# into the default Shopify search bar in the header, the predictive search was not not showing results for the SKU I typed in partially or whole, even though when I click 'search' and am taken to a hard search results page, I do see the product with the SKU number I searched.
To fix this in Dawn 14.0 I had to edit assets/predictive-search.js
Look for the Fetch request and update as follows:
fetch(`${routes.predictive_search_url}?q=${encodeURIComponent(searchTerm)}&resources[type]=product&resources[options][unavailable_products]=hide&resources[options][fields]=title,variants.sku,product_type,variants.title§ion_id=predictive-search`,
{ signal: this.abortController.signal }
)
.then((response) => {
if (!response.ok) {
var error = new Error(response.status);
this.close();
throw error;
}
We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024The Hydrogen Visual Editor is now available to merchants in Shopify Editions | Summer '...
By JasonH Sep 2, 2024