In the app: Agent Settings → Widget → Install → Install code. In Shopify: Online Store → Themes → ⋯ → Edit code → theme.liquid.
What do I need first?
- A SmartAlex agent that is active. If you have none, start with the quickstart.
- Your tenant ID, which the Install code panel fills in for you. A connected AI app can fetch it too.
- Edit access to your Shopify theme.
How do I paste it into theme.liquid?
This puts the widget on every storefront page.1
Open the theme code
In Shopify admin go to Online Store → Themes. On your theme, click ⋯ and choose Edit code.
2
Open theme.liquid
Under Layout, open
theme.liquid.3
Paste above the closing body tag
Scroll to
</body> and paste the tag on its own line directly above it, with your tenant ID in place of YOUR_TENANT_ID.4
Save and check
Click Save, open your live store in a new tab and hard refresh once.
How do I keep it in its own snippet?
A snippet keeps the tag in one named file that is easy to find and remove.1
Create the snippet
In Edit code, under Snippets, click Add a new snippet and name it
smartalex-widget.2
Paste the tag into it
Paste the full script tag into
snippets/smartalex-widget.liquid.3
Render it from theme.liquid
Add this line just before
</body>:Which widget style suits a store?
You choose the style in Agent Settings → Widget. Widget v2 gives voice and chat in one window. Pill is a small floating button, Chat bar and Side panel suit stores that prefer text, and Voice pill is voice only. See Widgets.Can the agent answer order questions?
General answers such as shipping policy and sizing come from your agent’s knowledge, but answering for one order needs a live lookup. A Custom HTTP Tool does that: the agent calls an HTTPS endpoint you host, passes the order number, and reads back what your endpoint returns. Your endpoint is where you talk to the Shopify Admin API, and Custom HTTP Tools need the Power Tools add-on (add-ons and prices).How do I check it works?
- Open your live store in a private window and check the widget shows on the home page and a product page.
- Send a text message such as “what are your shipping times” and check the agent replies.
- If you chose a voice style, start a call and check the audio connects.
- Check the chat appears in your Inbox as a Website conversation.
Questions people ask
Is there a SmartAlex app in the Shopify App Store?
Is there a SmartAlex app in the Shopify App Store?
No. You add the widget with one script tag in your theme. It needs no app and no plugin.
Can the agent tell a shopper where their order is?
Can the agent tell a shopper where their order is?
Yes, with a Custom HTTP Tool. During the chat, the agent calls an HTTPS endpoint you host, passes the order number, and reads back the status your endpoint returns. Custom HTTP Tools need the Power Tools add-on.
Can I test before going live?
Can I test before going live?
Yes. Duplicate your theme, add the script tag to the copy, preview it, and publish the copy when you are happy.
Do I need to edit the theme again when I restyle the widget?
Do I need to edit the theme again when I restyle the widget?
No. The widget reads its style, colours and agent from SmartAlex when the page loads. Changes in Agent Settings → Widget show on the next page load.
Related
Installing the widget
The full install guide and fixes.
Retail use case
How stores use an AI agent.
Agent tools
Set up the Custom HTTP Tool for order lookups.
Build overview
Guides for every other builder.

