How to Add an AI Chatbot to a Shopify Store Step by Step
You add an AI chatbot for Shopify by pasting the widget script into your theme’s theme.liquid file, just before the closing </body> tag. That’s the install. But first the bot has to learn from your own product, shipping and returns content. Sound familiar: the same questions about sizes, delivery and refunds piling up in your inbox every morning? This setup lets the assistant take those. One thing up front: this guide covers the script method, not installing a Shopify app, so it works on any theme whose code you can edit.
What an AI chatbot for Shopify can and cannot do
An AI chatbot for Shopify answers shopper questions from your store’s own content: product pages, shipping rules, the return policy and your FAQs. Shoppers see it as a chat widget on the storefront, and you add it with a single script. It answers questions; order changes and refunds stay with your team. Which topics should it cover first? Check the questions shop bots must answer, then hold that list up against your own inbox.
Step 1: Prepare the content your Shopify chatbot will learn from
Start by writing down the answers you already give over and over: delivery times per region, the return window, sizing advice, accepted payment methods, how to track an order. Boring? Sure. But every answer the bot gives comes from these materials. If it’s not in your sources, the bot can’t answer it. Simple as that. Source types that work well:
- Your shipping policy page, with carriers and delivery times for each region
- Your returns policy, covering conditions, deadlines and how refunds work
- A product FAQ built from real customer emails
- Sizing guides and care instructions, uploaded as PDFs
Keep one current version of each document. Just one. Otherwise the assistant may quote a rule you replaced months ago (and a shopper will hold you to it). If you want these files well structured, prepare shipping and returns documents before you upload anything.
Step 2: Set up the assistant and copy the widget script
Create the bot in the panel, then upload your prepared files or point it at the policy pages on your store. Now test it. Use real questions copied straight from your inbox, not ones you made up to sound tidy. Got a vague answer? Fix the source text, not the question. That’s the habit I’d push hardest here. Then adjust the widget colours, position and greeting so it looks like part of your store rather than a bolt-on. Once the answers hold up, copy the embed script from the panel. Pick a plan based on the traffic you expect, and use the plans sized by token allowance to compare monthly usage.
Step 3: How do you edit theme.liquid to add the chat widget?
To edit theme.liquid for chat, open the Shopify code editor and paste the script just above the closing </body> tag. In the admin, go to Online Store, then Themes, open the dots menu on your current theme and choose Edit code. Wait, though. Duplicate the theme first, so you’ve got a backup to roll back to. Then open layout/theme.liquid in the duplicate. It’s the layout file that wraps every storefront page, which is why one paste covers the whole store.
Put the script just above </body>, not in the <head> block. That way it doesn’t hold up the page’s first render. And leave the {{ content_for_header }} and {{ content_for_layout }} lines alone. According to the Shopify theme layout documentation, both objects are required, and if either goes missing the code editor won’t let you save the file. Small mercy, really.
Step 4: Test the chat widget in your Shopify theme before going live
Preview the duplicated theme and check the widget on desktop and mobile, across product, collection and cart pages. Run through this checklist:
- The widget loads on every page type
- It does not cover the cart, checkout or add-to-cart buttons on small screens
- Its answers match your current shipping and return policies
- Questions outside your content get a clear reply instead of a guess
That second point bites more often than you’d think on phones. Publish the duplicated theme only when every answer is right.
Keeping the AI assistant for your Shopify store accurate
The assistant is only as accurate as its sources, so update them every time shipping costs, carriers or return rules change. Read the conversation logs regularly. Look for the questions the bot fumbled, and add those answers to your documents. Aha, and one trap: theme updates and theme switches can wipe custom code. After any change, open theme.liquid and check the script is still there. Gone? Paste it back.
So: sources kept current, script in the right spot, answers tested. Do that and an AI chatbot for Shopify can take the repetitive questions off your plate. The same approach works for bots across other industries too. The content changes, the steps don’t.
FAQ
Do I need a Shopify app to add an AI chatbot?
No. A script pasted into theme.liquid does the job. It works on any theme that lets you edit the code, and there’s nothing to install from the app store.
Will the chatbot slow down my Shopify store?
Put the script just before </body> and the page content shows up first, with the widget loading after it. Keep it out of the head section. That’s where the resources needed for the first render belong.
Can the chatbot pass a conversation to my support team?
No. It answers only from the content you give it and can’t transfer a chat to a person. So add your contact email or contact form link to the sources, and the bot can point shoppers there when it doesn’t have an answer.
Related posts
Hotel Chatbot: Answering Guest Questions Around the Clock
A hotel chatbot on your website answers the questions guests keep asking: check-in times, parking, breakfast, house rules. It works at any…
Restaurant Chatbot: Menu, Allergen and Opening Hours Questions
A restaurant chatbot on your website handles the questions you hear over and over about the menu, allergens and opening hours. It…
Bots in a Clinic: What Changes When the Caller Is a Patient
Picture the front desk at nine on a Monday. A patient is standing there waiting to check in, the phone starts ringing,…