How to Add an AI Chatbot to Shopify (Theme Code Snippet)
Most Shopify support messages ask things your store already answers somewhere: shipping times, the returns window, sizes, payment options. A HolderChat bot reads your published store pages and files and answers those questions in a chat window on every storefront page. HolderChat does not have a Shopify app. You add it with the same one-line script tag it uses on any website, placed in your theme’s theme.liquid file.
The problem: answers exist, shoppers do not find them
Your shipping and refund policies are in the footer, the size chart is a link on the product page, and the contact page lists your email. Shoppers still write “Do you ship to Austria?” or “Can I return a sale item?” because asking is faster than searching. Each of those messages costs you time, and the ones that arrive at night wait until morning while the shopper may buy somewhere else.
What HolderChat does in a Shopify store
- Answers from your own content. The bot learns from the store pages you add as a website source, from files (PDF, DOCX, TXT, MD, XLSX or PPTX), and from Additional Context entries you write in the dashboard.
- Hands over to a person. When a shopper asks for a human, the question can go to your Telegram group. Your reply in Telegram appears in the shopper’s chat.
- Shows you what shoppers ask. Conversation History lists past chats, so you can see which questions your pages do not answer yet.
- Masks personal data before the AI call. With Anonymize customer data on, personal data the anonymizer detects in shopper messages, such as names and emails, is masked or replaced before it is sent to OpenAI.
What it does not do
- It is not connected to Shopify orders, stock or customer accounts. It cannot look up one shopper’s parcel. It can explain where your tracking page is, if one of your pages says so.
- It does not follow your store edits by itself. After you change prices, policies or important product pages, re-parse the website source and click Rebuild Bot.
- It does not appear in checkout. Shopify’s developer documentation describes
theme.liquidas the layout for all non-checkout pages, so a script placed there is not added to checkout.
Before you start
- Your storefront should be open to the public. The website source reads pages the way a visitor does, so a password-protected store shows it the password page instead of your products. Until you launch, upload the key content as files.
- You need permission to edit theme code. Shopify only lets you edit the code of a theme you own. If you are trying a paid theme, you have to buy it first.
Step by step: add the chatbot to Shopify
- Create a chatbot. Register on holderchat.com, open the Dashboard and click Create Your First Chatbot.
- Add your store as a website source. In Knowledge Sources click Add Website, enter your store URL with
https://, review the menu preview, keep the shipping, returns, FAQ, contact and important product pages, and start parsing. Upload size charts or other documents as files if they are not on a page. - Rebuild and test. Click Rebuild Bot, wait until the status is Active, then ask real shopper questions in Test Chatbot. See Testing Your Chatbot.
- Copy the embed snippet. Open Widget Appearance, set the colour scheme and launcher button if you want, and copy the Script snippet under Embed on your website.
- Duplicate your theme. In Shopify admin go to Online Store → Themes and duplicate the current theme as a backup. Shopify recommends this before any code change.
- Open the theme code. On the current theme, click the … menu and choose Edit code. Open
layout/theme.liquid. - Paste the snippet before the closing body tag. Paste the HolderChat script on its own line just above
</body>and click Save. - Check the store as a shopper. Open the store in a private window with ad blockers off, look for the chat button in the corner, and ask two or three questions your customers really ask.
The snippet looks like this, with your bot’s token in place of YOUR_TOKEN:
<script src="https://holderchat.com/dynamic/get.js?token=YOUR_TOKEN" async></script>
Paste one snippet only. HolderChat also offers an iframe embed (/dynamic/iframe.js) that isolates the widget and is the only method that runs custom CSS or JavaScript. Use it instead of the script embed, not next to it. Details: Embedding the Chatbot Widget.
After theme updates and theme changes
Shopify warns that code edits can be dropped when you install an updated copy of a theme. After a theme update, or when you publish a different theme, open theme.liquid again and check that the HolderChat line is still above </body>. Keep the snippet somewhere safe so you can paste it back.
Questions the bot can handle in a store
The bot can answer these when the answer is written on a page or in a file you gave it:
- “How long does delivery to Germany take, and what does it cost?”
- “Can I return something I bought on sale?”
- “Which size should I order if I am usually between M and L?”
- “Which payment methods do you accept?”
- “Is this product dishwasher safe?” (if the product page says so)
- “Where do I track my order?” (it points to the tracking information on your pages, it does not look up the order)
- “Can I talk to someone?” (handed to your support channel)
If the bot answers with something your pages do not say, the fix is usually on the page, not in the prompt. Write website pages an AI chatbot can answer from shows how. For questions every store gets, see the AI chatbot guide for online stores.
Privacy and cookies
The script embed sets two cookies, holderchat_user_id and holderchat_talk_id, for 48 hours so a shopper can continue a chat. Shopper messages are sent to HolderChat to generate replies and may be sent to OpenAI. Mention the chat in your privacy policy. If you use a consent tool that blocks scripts until the shopper agrees, the chat button appears after consent, which is expected. Tell shoppers in the welcome message that they are chatting with an AI assistant.
FAQ
Is there a HolderChat app in the Shopify App Store?
No. You add HolderChat to Shopify with the standard script embed in your theme code, as described above.
Will the chat appear on the checkout page?
No. The snippet goes into theme.liquid, which Shopify uses for non-checkout pages. Checkout is rendered separately.
Does the bot update when I change a product or a policy?
Not by itself. Re-parse the website source in Knowledge Sources and click Rebuild Bot. Answers use the new content once the status is Active again.
Can the bot tell a shopper where their order is?
No. HolderChat is not connected to Shopify orders. It can point to your tracking page or hand the conversation to a person.
Does the widget slow down my store?
The script tag loads with async, so it does not block the page from rendering. Measure your own store before and after if speed matters to you.
Can I show the chat only on some pages?
Yes, with Liquid conditions around the snippet in theme.liquid, for example only on product and page templates. Test each template after the change.
Can the bot answer in more than one language?
Yes. Add language packs in the Languages tab. The widget can start in the visitor’s browser language when a pack exists.
What does HolderChat cost?
HolderChat is currently free, and no credit card is needed. See Free access.
Related guides
- AI chatbot for online stores: what to give the bot and which questions to send to a person
- Add an AI chatbot to WordPress, if you sell with WooCommerce
- Hand off website chat to a human
- Test your website chatbot before you go live
Try it on your store. Create a bot, add your shipping and returns pages, and paste one line into theme.liquid. HolderChat is currently free.