Shopify is the easiest way to launch your e-commerce store and start selling. Here’s how a Shopify search API will help you to install the complete functionality of a google-like search bar into your Shopify store. The Expertrec code would look like this:
<script>
(function() {
var id = 'Your_API_Key';
var ci_search = document.createElement('script');
ci_search.type = 'text/javascript';
ci_search.async = true;
ci_search.src = 'https://cse.expertrec.com/api/js/ci_common.js?id=' + id;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ci_search, s);
})();
</script>
Create Shopify Search API with Expertrec
Understanding Shopify Search API – Oh Guy!
Expertrec search API can be used to integrate your Shopify store with search functionality. The API key is different for each Shopify store. It is a set of codes to exchange the data between the search query and search result. The API key is an identifier that is unique for every store. You can create an API during the setup process. For instance, this is the search API for writerorg.myshopify.com.
https://searchv7.expertrec.com/v6/search/c8017851-46f8-4fd9-b738-1e727cbb9c16/?q=a
Here, the API format is:
https://searchv7.expertrec.com/v6/search/{org_id}/?q={keyword}&page={pagination}&size={total_number_of_search_results}
org_id
is a unique ID that is generated once you log in to Expertrec with your Google account. It is different for each Shopify store.- Keywords are assigned to
q
(query). This parameter defines the fields to be searched. The keywords would be added automatically (space is counted as+
, and if you want to ignore something in your search result, use-
and then write the keyword. As shown below,
The query “expertrec shopify” is transformed as follows since that’s the keyword for our search.
https://www.google.com/search?q=expertrec+shopify
- Pagination is assigned to the
page
that is navigation between pages. Whenever your search for a query, you will see the pagination as shown below. size
is the total number of search results that have to be displayed.
The search results will be shown in JSON format as shown below:
{ "0len":1, "1query":"a", "facet_interval":{ }, "facets":{ "type":{ "webpage":160 } }, "fq":{ }, "nf":{ }, "numeric":{ }, "res":{ "count":160, "st":0, "time":3 }, "results":[ { "date":"2021-04-28T13:48:47.110Z", "host":"blog.expertrec.com", "id":"https://blog.expertrec.com/shopify-search-api/", "image":[ "https://blog.expertrec.com/wp-content/uploads/2021/04/searchapi.png" ], "popularity_score":1.0, "score":1.25, "snippet":{ "content":[ "How to <span class=highlight>add</span> <span class=highlight>a</span> shopify search api <span class=highlight>for free</span> - 2021 Expertrec Support <span class=highlight>shopify</span> <span class=highlight>search</span> engine Google site <span class=highlight>search</span> <span class=highlight>replacement</span> Expertec Toggle <span class=highlight>Navigation</span> How to <span class=highlight>create</span> <span class=highlight>a</span> shopify search <span class=highlight>api</span> Published by <span class=highlight>naincy</span> <span class=highlight>mourya</span> on <span class=highlight>April</span> 28, 2021 <span class=highlight>Creating</span> shopify search api <span class=highlight>using expertrec is <span class=highlight>as</span> <span class=highlight>easy</span> <span class=highlight>and</span> <span class=highlight>can</span> be <span class=highlight>taken</span> live in few minutes. " ], "metatag.description":[ ], "title":[ "How to <span class=highlight>add</span> <span class=highlight>a</span> shopify search api <span class=highlight>for free</span> - 2018 Expertrec" ] }, "title":"How to add shopify search api for free - 2018 Expertrec", "type":"webpage", "url":"https://blog.expertrec.com/shopify-search-api/" } ], "sfacets":{ "type":[ { "count":160, "name":"webpage" } ] } }
How to add Shopify Search API without code?
You can add Shopify Search API within seconds and witness the change within few minutes. There are two easiest ways to add Shopify Search API in your online store.
1. Expertrec Shopify Search App
2. Expertrec Shopify Search Plugin
Also, you can always add code and modify the default search bar. Since it is harder for non-coders, we will talk about it in the later section. Let’s get started with the easiest way:
1. Expertrec Shopify Search App
Note: The Expertrec Shopify Search App is listed on Shopify App Store.
i. Click on https://apps.shopify.com/expertrec-smart-search-bar to install the search API.
ii. After installation, please enable the search extension, and you are all set to use a modified search bar that really listens to you!
Now, Install the Expertrec Search API by clicking on the install button.
Now, click on Start Free Trial to access Shopify Search API.
Make sure that the Expertrec Smart Search API is enabled.
Here you get Expertrec Smart Search Bar on your Shopify Store.
2. Expertrec Shopify Search Plugin
The second method is quite similar to the first one. I’m sure you will get the App installed through the first method already.
i. Click on https://www.expertrec.com/shopify/
ii. Enter the URL of your Shopify store in the Shop domain.
iii. Click on the install button.
iv. Log in to your Shopify Store and click on install.
v. Expertrec Search Plugin is installed.
vi. Check the apps section to confirm that the Expertrec Search App is installed.
How to add Shopify Search by copying code?
You can create a Shopify Search Bar using Expertrec Custom Search (zero ads) and Google Custom Search(a lot of ads).
The two most popular Custom Search Engines are:
1. Expertrec Custom Search Engine (zero ads, fast search, and voice search availability)
2. Google Custom Search Engine (free version with ads and absence of voice search)
Let’s dive into it and explore both of the CSE.
1. Creating a Search bar using Expertrec Custom Search
i. Firstly, log in to your Shopify store to access the admin panel.
ii. Click on Online Store and select the Theme option.
iii. On the right-hand side, click on Actions.
iv. A drag-down menu will appear. Select Edit code option located at second top from bottom.
v. In the layout, click on theme.liquid to add the code. You will see a section of code on the right-hand side.
vi. Now Click on https://cse.expertrec.com/csedashboard/home/code to access the code.
vii. Login with your Google Account and continue to add code to your Shopify store.
viii. Copy the code and the tag. Copying both of them is a must.
ix. Paste the code in the <head> section as shown below. Make sure it just below the head section.
x. Paste the tag inside the <body> section as shown below.
xi. Save the code and you are all set to access the Expertrec Shopify Search bar in your store. You will get the Expertrec Search bar that is really fast. It successfully understands queries in 30+ languages. This makes it a search bar that understands the words of users. It supports autocomplete and recommend searches. There are a lot more benefits. All you need is to install the Expertrec search bar. Integrating it with your Shopify store will help to launch your Shopify store to the next level.
2. Creating a Search Bar using Google Custom Search
It is an upfront free tool to add a search bar to your store. That means you can install Google Custom Search for free, but with time, you will have to pay the price. It works by showing ads, and you already know that ads can really steal your customers with a single click. Still, if you choose GSS for experimentation, here’s how to do it.
i. As before, log in to your Shopify store to access the admin panel.
ii. Click on the Online Store and select the Theme option.
iii. Click on Actions on the right-hand side and click on the Edit code option in the drop-down menu.
iv. Now, Click on https://cse.google.com and get started.
Enter your website URL. You can name your Custom Search Engine.
v. Tap to create. Click on Get code. After that, you will get the code.
And now, you need to copy the code. You can click on the right-hand side. There is a “See HTML example” button. Clicking on it will show you where and how to add the code in your Shopify store or any other website.
vi. Paste the code in Layout -> theme.liquid -> Body section (<body>) as following. The highlighted part is the required code. Make sure that the code is between the two <div>.
vii. You are successfully adding the Google Custom Search to your Shopify store. Whenever you search a query, you will get the results with ads. So, it is always better to go with the best. Having ads are not a major concern when you are just starting out. But, in the long run, it hampers the sale and affects overall business growth.
Wrapping up – Shopify Search API
A Shopify Search API is similar to an app on your mobile phone. For instance, you open Uber Eats and searched for your favourite food. Here, you created a query that you want to eat “Pizza”. The app connects to the server and sends the data. The server replies back that “Pizza” is available, and once you click the order button, the delivery guy receives a notification for your place and heads on to it.
In a nutshell, Shopify Search API helps the users to generate a query and retrieve a relevant result. The search algorithm goes beyond it by adding sorting, filter, etc., options in order to narrow down the search result. It explicitly depicts a co-relation between search intent and the last stage of the buyer’s cycle, i.e., making a purchase.
Make sure that you select the best search API like Expertrec. It is never a good idea to lose your customers because of ads that come with Google Search API. The choice is yours. Go for the best, i.e., Expertrec.