Adding Search Button To Shopify
Complete step-by-step guide
Last updated
Complete step-by-step guide
Last updated
When shoppers open your store’s predictive-search drop-down they’ll see a “Search with Shopping Assistant” call‑to‑action that:
Renders a branded Alhena button at the top of the panel
Sends the current query to your embedded Alhena widget so the AI can answer in chat
Alhena widget already installed
Code below calls window.gleenWidget.sendMessage()
Theme code access
Online Theme Editor (Admin → Online Store → Themes → … → Edit code
)
SVG icon ai-search-with-alhena.svg
Lives in assets/ folder—upload before testing
Download the SVG icon:
sections/predictive-search.liquid
Open the file.
Locate:
Directly beneath that line, paste the entire Alhena button block:
Tip: Keep indentation identical to surrounding Liquid to avoid merge‑conflict noise.
assets/component-predictive-search.css
Append (or merge with utility file) exactly this block:
assets/predictive-search.js
Find the existing open()
function and replace it with the full version below (or inject only the added lines if you maintain patch files):
In the left sidebar of the theme editor choose Assets → Add a new asset → Upload file
Select ai-search-with-alhena.svg
Confirm the path in Liquid matches:
Save all modified files in the code editor.
On your storefront, start typing in the header search bar.
In the predictive-search panel you should see:
Standard search results
A left‑aligned “Search with Shopping Assistant” button
Click the button → the active query is passed to your Alhena chat widget.
Shopify auto‑saves file history. If anything breaks:
Re‑open the modified file.
Click Older versions drop‑down (top‑right) and choose a timestamp before your change.
Save.