Skip to content

How to Add an AI Chatbot to Shopify in 7 Steps (Without Breaking Your Theme)

Add an AI chatbot to Shopify via Edit code → theme.liquid, or an app. Back up first, what theme updates break, and what the bot must never promise.

By Jahidul Hossain Mekat12 min read

On this page

To add an AI chatbot to Shopify, duplicate your theme as a backup, go to Online Store, click the ⋯ menu next to your theme and choose Edit code, open layout/theme.liquid, paste the chatbot’s script just before </body>, and save. It then appears on every storefront page. If you’d rather not touch code, install a chatbot from the Shopify App Store instead. Either way, test that it answers from your own product and policy pages and never invents stock, prices or delivery dates.

Two ways to add a chatbot to Shopify: code or app

Shopify gives you two routes, and Shopify itself has a preference: its help centre says you “should only edit your theme’s code if you can’t make the changes that you need by using a Shopify app or by using the theme editor” (Shopify Help). That’s sound advice for big changes. Pasting one script tag is about as small as code edits get, so both routes are fine; pick by the chatbot you want.

Script in theme.liquidApp from the Shopify App Store
Works withAny chatbot that gives you an embed scriptOnly chatbots with a Shopify app
Setup time5 minutes2 to 5 minutes
Survives a theme switchNo: paste it into the new themeUsually yes, via an app embed you turn on in the theme editor
Survives a theme updateOnly if the update doesn’t conflict (see below)Yes
Can read ordersNo, it reads your public pagesSome apps can, with the permissions you grant
Removing itDelete the lineUninstall the app; check the theme for leftover code

One more option for testing: Online Store 2.0 themes have a Custom Liquid section in the theme editor. It puts code on one template or page only, which is handy for trying a chatbot on a single page before going site-wide.

What you need before you start

  • Staff or owner access with permission to edit themes. You can only edit a theme’s code after you’ve purchased it, if it’s a paid theme (Shopify Help).
  • A live store, not password-protected. A chatbot that reads your website can’t read pages behind Shopify’s storefront password. Launch first, or wait to connect the chatbot until you do.
  • Your chatbot’s script. One line that starts with <script. In Site Can Talk, paste your store’s address to sign up; the Add it to your website panel has a Copy code button. It looks like this:
    <script async src="https://…/w.js" data-site="your-site-id"></script>
  • Clear policy pages. Shipping, returns, sizing and contact pages in plain text. These answer most pre-sale questions, and a chatbot can only quote what’s published.

How to add an AI chatbot to Shopify with theme.liquid: 7 steps

  1. Back up your theme. In Online Store → Themes, click ⋯ next to your current theme and choose Duplicate. Shopify recommends this so you can “discard your changes and start again if you need to” (Shopify Help).
  2. Open the code editor. On the current theme, click ⋯ → Edit code. On the Shopify mobile app: Menu, then Online Store under Sales channels, Manage themes, ⋯ → Edit code.
  3. Open theme.liquid. In the file list on the left, under Layout, click theme.liquid. This is the layout that wraps every storefront page (Shopify developer docs).
  4. Find the closing body tag. Press Ctrl+F (Cmd+F on a Mac) and search for </body>. It’s near the bottom of the file.
  5. Paste the script on the line just above it. Don’t paste it inside another tag or a {% if %} block, or it may only load on some pages.
  6. Save. Click Save (or Ctrl+S). Changes to your published theme go live at once.
  7. Test on the live store. Open your store in a private window, on a phone and a computer. The chat button should appear on the home page, a product page, a collection and the cart.

In Site Can Talk, also add every address your store answers on under Settings → Websites allowed to use it: your custom domain and, if you test there, your yourstore.myshopify.com address. The assistant refuses to run on sites not on that list, so copies of your code elsewhere don’t use your allowance.

What happens to the chatbot when you update or switch themes?

This is the one real drawback of the code route. Shopify warns: “If changes that you’ve made to a theme’s code are incompatible with a theme update, then all your code changes are removed in the updated copy” (Shopify Help). Switching to a different theme also leaves the old theme’s code behind.

So keep a note of the script, and after any theme update or switch:

  1. Open the store in a private window and check the chat button is there.
  2. If it isn’t, repeat steps 2 to 6 on the new or updated theme.
  3. Check the old theme isn’t still published by mistake.

Two minutes of checking after each update is the whole cost. It’s also a good habit for any other script you’ve added, such as analytics or review widgets.

How to show the chatbot on some pages only

Pasting the script in theme.liquid loads it everywhere, which is right for most stores. If you want it only on product pages, or everywhere except the cart, don’t move the code: use the chatbot’s own page rules. In Site Can Talk that’s Settings → Where it shows, with three choices: Every page, Only these pages or Every page except these, and one pattern per line where * matches anything. Examples for a Shopify store:

GoalChoicePatterns
Products and collections onlyOnly these pages/products/*, /collections/*
Everywhere except the cartEvery page except these/cart*
Not on your blogEvery page except these/blogs/*
Policy and FAQ pages tooOnly these pages/products/*, /policies/*, /pages/faq

Keeping the rule in the chatbot’s settings means a theme update can’t break it, and you can change it without editing code.

Selling in several countries or languages?

If you use Shopify Markets to sell abroad, shoppers often see a translated storefront on a different path or domain. Two things to set up:

  • Allowed addresses: add every domain your markets use to the chatbot’s allowed list, or the chat won’t load there.
  • Shipping facts per market: make sure each market’s shipping rates and times are on a readable page. A shopper in Germany asking about delivery needs the German answer, not the domestic one.

A good assistant replies in the shopper’s language from your main pages, so you don’t need to maintain a separate set of answers per language. Test the shipping and returns questions in each language you sell in.

What to do with enquiries the chatbot collects

Some shoppers won’t buy until a person answers: wholesale orders, custom sizes, gifts with a deadline. A chatbot that answers from your pages can’t close those; it can only get them to you. Make that hand-off count:

  1. Reply the same day. A shopper who asked about a bulk order is comparing suppliers right now. Our speed-to-lead research shows how quickly interest fades.
  2. Answer the question they asked first, then offer the product link. Don’t open with a sales pitch.
  3. Turn repeat questions into pages. If three people ask about gift wrapping in a week, add it to your FAQ so the assistant (and everyone else) can answer it next time.

Site Can Talk emails you each enquiry with the shopper’s question and the page they were on.

Will the chatbot show on Shopify’s checkout?

No, and that’s usually what you want. Your theme’s layout wraps the storefront, while Shopify runs checkout separately, so a script in theme.liquid appears on product, collection, cart and content pages but not in checkout. The questions that stop people buying are asked before checkout: delivery cost and time, returns, sizing, whether a product suits them. Our guide to add to cart but no purchase covers the checkout side.

The cart page is the last place the chat appears, so make sure your shipping and returns answers are easy to reach from it. A shopper who hesitates in the cart usually has one question left, and it is nearly always about cost, delivery time or returns.

What should a Shopify chatbot answer?

Pre-sale questions, from your own pages. The biggest one is cost. Across Baymard Institute’s compiled studies, the average documented online cart abandonment rate is 70.22%, and extra costs (shipping, tax, fees) are the top reason shoppers give for leaving checkout (Baymard Institute). A shopper who can ask “how much is delivery to Leeds?” on the product page doesn’t have to find out at checkout.

Shopper asksPage that answers itThe chatbot must never
“How much is shipping, and how long?”Shipping policy with rates, zones and timesPromise a delivery date you haven’t published
“Can I return it if it doesn’t fit?”Returns policyMake exceptions or offer refunds
“What size should I get?”Size guide, product measurementsGuess beyond the size guide
“Is this in stock in blue?”The product pageConfirm stock: it changes faster than the bot re-reads your site
“Do you have a discount code?”Only if you publish oneInvent codes or offers
“Where’s my order?”Order status page, tracking emailPretend to look it up if it can’t

The right-hand column is where general-purpose bots get stores into trouble. If a bot invents a code or a promise, you’re the one who has to honour it or explain why not. Our guide to chatbot hallucinations has a test you can run in 15 minutes.

What about stores with hundreds of products?

Most website chatbots read your store the way a search engine does: by crawling pages, not by connecting to your product database. That has limits worth knowing:

  • Page limits. Site Can Talk reads up to 100 pages each time it re-reads your site, and you can pin up to 20 you always want included. For a large catalogue, pin the shipping, returns, sizing and FAQ pages, plus your best sellers and main collections.
  • Freshness. Prices and stock on a crawled page are as of the last read. Tell the assistant to send people to the product page for live price and availability rather than quoting stock.
  • Variants. If sizes and colours only appear in a drop-down that loads with JavaScript, a crawler may not see them. List key variant information in the product description too.

If you need live order lookups or stock checks inside the chat, you want an app that connects to Shopify’s data with permissions you grant, and you should read exactly which permissions it asks for.

Shopify chatbot apps vs a script: which to choose

Your storeWhat fits
You want to chat with shoppers yourselfShopify’s own free Shopify Inbox app
Lots of “where’s my order?” questionsA help-desk app that reads order data (Gorgias, Tidio, Zendesk and similar)
Pre-sale questions while you’re busy or asleep; leads by emailA site-grounded assistant via script, such as Site Can Talk
Shoppers who’d rather talk than typeA chatbot with voice in the browser (few have it; ours does)
Several languagesAny tool that replies in the shopper’s language from your pages; test each language

Prices vary widely by how tools bill; our AI chatbot pricing comparison lists 15 tools side by side.

Chatbot not showing on Shopify? Fixes

SymptomLikely causeFix
No chat button anywhereCode pasted in an unpublished theme or a duplicateCheck which theme is “Current” and edit that one
Button on some pages onlyPasted inside an {% if %} block or a section fileMove it to the line just above </body> in theme.liquid
Disappeared after an updateTheme update removed custom codePaste it again; keep a copy of the script
Button shows but won’t answerThe store’s address isn’t on the allowed listAdd the domain (and myshopify.com address) in the chatbot’s settings
Answers “I don’t know” about shippingPolicy only in an image, PDF or the checkoutPublish a plain text shipping page and re-read the site
Overlaps another floating buttonTwo widgets in the same cornerMove one to the other corner in its settings

A 10-question test before you rely on it

Ask these in a private window and note each answer:

  1. Shipping cost to a real address in your main market (should quote your policy).
  2. Shipping to a country you don’t serve (should say so, not guess).
  3. Your returns window (exact number of days).
  4. A size question your size guide covers.
  5. “Is it in stock?” (should send to the product page, not confirm).
  6. “Any discount codes?” (should only mention published offers).
  7. A product you don’t sell (should say you don’t, not suggest a competitor).
  8. “Where’s my order #1234?” (should point to order tracking).
  9. The same shipping question in a second language.
  10. “Can someone call me?” (should take details once, and you should receive them).

If a store owner sells on several platforms, the same steps apply elsewhere: see our guides for WordPress, Wix, Squarespace, Webflow and Framer. And if your store gets visitors but no sales at all, start with why a Shopify store gets traffic but no sales.

Questions

How do I add an AI chatbot to my Shopify store?

Either install a chatbot app from the Shopify App Store, or paste the chatbot's script into your theme: Online Store, the ⋯ menu next to your theme, Edit code, Layout/theme.liquid, just before </body>, then Save. Duplicate the theme first as a backup.

Where do I paste a chatbot script in Shopify?

In layout/theme.liquid, on the line just above the closing </body> tag. That layout wraps every storefront page, so the chatbot appears site-wide.

Will a theme update remove my chatbot code?

It can. Shopify says that if your code changes are incompatible with a theme update, all your code changes are removed in the updated copy. Check the chat button after every update and paste the script again if needed.

Does the chatbot appear on Shopify checkout?

Not from theme.liquid. Shopify runs checkout separately from your theme, so the chatbot shows on product, collection, cart and content pages, which is where pre-sale questions are asked.

Is there a free AI chatbot for Shopify?

Yes. Shopify Inbox is free for chatting with customers yourself, and several AI chatbots have free plans; Site Can Talk's free plan covers 200 chat messages and 10 voice minutes a month and works on Shopify through the theme.liquid script.

Can I show the chatbot only on product pages in Shopify?

Yes. Keep the script in theme.liquid and use the chatbot's page rules instead of moving code. In Site Can Talk, Settings, Where it shows, choose Only these pages and add /products/* and /collections/*.

Can a Shopify chatbot check stock or order status?

Only if it connects to your Shopify data through an app with permissions. A chatbot that reads your website should send shoppers to the product page for live stock and to order tracking for order status, rather than guessing.

About the author

Jahidul is the founder of Site Can Talk, the AI chat and voice agent that answers a business's website visitors from its own pages and sends every lead to the owner.

Jahidul Hossain Mekat on LinkedIn

Sources

  1. Shopify Help Center, read 25 Nov 2026Editing theme code
  2. Shopify developer documentation, read 26 Nov 2026Layouts (theme.liquid)
  3. Shopify Help Center, read 25 Nov 2026Customizing themes: adding custom code
  4. Shopify App Store, read 26 Nov 2026Shopify Inbox
  5. Baymard Institute, read Nov 2026Cart abandonment rate statistics