Add Live Chat to Shopify Safely: Duplicate Your Theme, Paste in theme.liquid, and Keep the Chat Through Theme Updates (Free theme.liquid Checker)
Add live chat to Shopify and you’ll be editing one file: theme.liquid, the layout every storefront page shares. It takes ten minutes, but store owners worry about breaking the theme, and with good reason: a code edit in the wrong place can hide the chat on most pages, or vanish the next time the theme updates. This guide shows the safe way: back up first, paste in exactly the right spot, know which pages the chat can and can’t reach, and keep it alive through theme changes. A free checker reads your pasted theme.liquid and flags mistakes.
⚡ In short
- There’s no Shopify app for LiveChatBot. You paste one line of code into theme.liquid, just above the closing body tag.
- Duplicate your theme first. It costs nothing and gives you an instant way back.
- Never paste the code inside a Liquid if-block, or the chat only appears on some pages.
- Shopify’s checkout and the store’s password page don’t use theme.liquid, so the chat won’t appear there unless you plan for it.

What you’re changing
One layout file that every storefront page shares
Every Shopify theme has a folder called Layout with a file called theme.liquid. Think of it as the frame around every page of your store: the header, the footer and the code that loads on every page sit in it, and your home page, collections, products, cart and blog posts are slotted into the middle.
That makes it the right place for chat. Paste the chat code into theme.liquid once and every page that uses the frame gets the bubble. There’s nothing to install, no app subscription and no permissions to grant. The code simply asks LiveChatBot’s server for your chat window when a page loads, so colours, welcome text, opening hours and rules are all changed later from your LiveChatBot dashboard, never in Shopify.
It also explains the two ways people go wrong. First, if the code ends up inside a section or snippet that only loads on certain templates, the chat only shows there. Second, because the edit lives in one theme, switching or updating themes can leave it behind.
Both are easy to avoid once you know about them. The steps below take care of the first; the section on theme updates covers the second.
If you’re not sure your store is on Shopify (for example, someone else set it up), our platform detector reads your page source and confirms it. For a wider view of chat on Shopify, including what to answer and how to measure it, see Shopify live chat.
Six steps
The safe install, start to finish
In your LiveChatBot dashboard, open your website’s install page and click Copy chat code.
Online Store → Themes → ⋯ next to your live theme → Duplicate. This is your backup.
On the live theme: ⋯ → Edit code. In the Layout folder, click theme.liquid.
Search the file for the closing body tag. Put the code on its own line just above it, outside any {% if %} block.
Click Save. Open your store in a private window: home, a product, a collection and the cart.
Send a test message from your phone on mobile data and reply from the inbox or the Android app.
Steps 2 to 4 in detail
Back up, find the right line, and paste
Why duplicate first
Duplicating creates an unpublished copy of your theme, exactly as it is now. If anything looks wrong after your edit, you can publish the copy and you’re back where you started in seconds. Shopify also keeps a version history for each file in the code editor, but a full duplicate is simpler to understand and covers every file at once.
Edit the live theme or the copy?
For a one-line change like this, editing the live theme is fine and avoids a common trap. If you edit the duplicate and publish it later, any changes made to the live theme in between (a new banner, a menu change from the theme editor) are lost, because the copy is older. So: duplicate as a backup, then edit the live theme.
Finding the closing body tag
In the code editor, click inside theme.liquid and use your browser’s find (Ctrl+F or Cmd+F) to search for the closing body tag. It’s usually near the very end, just before the closing html tag. Click at the start of that line, press Enter to make a blank line above it, and paste your code there.
What not to touch
Don’t paste inside the head section’s content_for_header line, inside a section tag, or between an if and an endif. If the lines just above the closing body tag are part of a Liquid block, paste below its endif, still above the closing body tag.
Once you add live chat to Shopify this way, the edit is one self-contained line, which makes it easy to find and move later.
Free tool
Check your theme.liquid before you save
Paste the last part of theme.liquid. The checker finds every copy of the chat code, flags conditions, placeholder keys, wrong positions, duplicates and leftover chat tools.
Paste the end of your theme.liquid file, from a few lines above your chat code down to the closing </html> tag. Pasting the whole file is fine too.
Runs only in your browser; nothing is sent or saved.
Reading the checker
The four mistakes it catches most often
Pasted inside a condition
Many themes wrap the last few lines in a condition, for example `{% if template.name == 'index' %}`, which means "only on the home page". Code pasted inside that block only loads on the home page, and owners think the chat is "broken" on products. The checker shows the condition so you can move the code outside it.
A placeholder key
Tutorials, including ours, show example code with a made-up key. If you copied from a tutorial instead of your dashboard, the bubble won't load. Always use the Copy chat code button, which includes your real key.
Below the closing body tag
Browsers usually still run code placed after the closing body tag, but it's invalid HTML and some theme tools move or strip it. Keep it just above.
Two copies, or an old chat tool
A second copy usually comes from someone trying again after a cache delay. An old tool's script is often left from a free trial years ago. Either way, visitors can end up with two bubbles. Delete the extra copy, and remove the old tool's app or code.
The checker also notes when an old script sits inside a comment block. Shopify never outputs commented code, so it's harmless, but deleting it keeps the file readable for whoever edits it next.
Coverage
Where the chat appears on a Shopify store
Not every page a shopper sees is built from theme.liquid. Plan for the gaps.
| Page | Uses theme.liquid? | Chat shows? | What to do |
|---|---|---|---|
| Home, collections, products, search, blog, pages | Yes | Yes | Nothing; this is where most questions come from. |
| Cart page | Yes | Yes | Keep it: delivery and COD questions peak here. Hide with a page rule only if you must. |
| Checkout and thank-you pages | No (Shopify hosts them) | No | Answer payment and COD questions before checkout, on product and cart pages. |
| Password page (before launch) | No (uses its own layout) | No | Paste the code in the password layout too if you want pre-launch chat. |
| Customer account pages | Depends on your account type | Sometimes | Check by logging in as a test customer. |
| Your blog on another platform | No | No | Install the chat on that site separately. |
Showing it in the right places
Hide on some pages, greet on others
Most stores want the chat everywhere it can reach. A few want it quieter on certain pages, and LiveChatBot gives you two tools for that, both in the dashboard, so you never have to edit theme.liquid again.
Hide the bubble on specific pages
Under "where it shows" you can list pages to hide on. A rule hides the chat on any page whose address contains the text you enter. Shopify addresses follow a fixed pattern, which makes this easy:
- /cart hides it on the cart page.
- /pages/wholesale hides it on one information page.
- /collections/sale hides it on one collection.
Be careful with short rules. A rule like /products hides the chat on every product page, which is rarely what you want. See showing chat on specific pages.
Greet shoppers on product pages
Flows can send a proactive message based on the page, the visitor's source, country, device, number of visits and more. A product-page Flow such as "Questions about size or delivery? Ask here" after a short pause works well for fashion and gifting stores. Our proactive chat guide has timing ideas.
Devices and countries
You can also limit the chat to certain devices or countries, which helps if you only ship within India and get overseas traffic you can't serve.
Theme updates
Keep the chat when you update or switch themes
Here's the part most guides leave out. Your code lives inside one theme. When you install a theme update from the theme store, or switch to a new theme, Shopify typically adds it to your theme library as a separate theme, and code you added by hand may not come with it.
Owners then publish the shiny new theme and the chat disappears. Weeks later someone notices that no chats have come in.
Build a habit around it:
- Before publishing any new or updated theme, open its theme.liquid in the code editor and check for the chat code. Paste it if it's missing.
- Run the checker on the new theme's theme.liquid, because new themes often have different conditions near the end of the file.
- Preview the new theme and look for the bubble before you click Publish.
- Keep a note in a document your team uses: "Chat code: Layout/theme.liquid, line above the closing body tag." Anyone who edits the theme later will know.
If a developer or agency maintains your store, send them this list. It costs them a minute per update and saves you from silent weeks without chat.
Our guide to keeping chat working through a redesign covers bigger moves, such as switching platforms.
Common mistakes
What goes wrong, and the fix
After install
After you add live chat to Shopify, set it up for shoppers
With the bubble live, spend twenty minutes making it useful for the questions Shopify stores actually get.
Write your welcome line. Name the two or three things people ask most: "Questions about delivery, COD or sizes? Ask here." Our welcome message guide has examples.
Load your store policies as answers. Shipping times, COD limits, returns and exchange rules should go into the AI Agent's knowledge and your saved replies, so the bot answers them instantly. Our Shopify chat replies post has ready-to-paste answers built from typical store policies.
Set opening hours and the away form. After hours, the away form collects an email or phone number so no shopper is lost.
Install the Android app. Most store owners answer from their phone. Alerts arrive even when the laptop is closed.
Plan for sale days. On the free plan each website gets 100 visitors a month. Visitor packs (100 for ₹99, 500 for ₹299, 1,000 for ₹499) never expire, so buy one before a big sale rather than during it. Over the limit, tracking and alerts continue but chat pauses for new visitors, and nothing is charged automatically.
Once you add live chat to Shopify and set these up, you'll see within a week which questions cost you sales, and you can answer them on the product pages too.
Checklist
Shopify chat go-live
Getting started
Ten minutes from now, shoppers can ask
Duplicate your theme, paste the code, run the checker and test on your phone. Then set your welcome line and policy answers.
LiveChatBot's free plan covers two websites, each with 100 visitors a month, plus the team inbox, the Android app, Flows, opening hours with an away form, tickets and the AI Agent with a small free monthly allowance. There are no per-seat charges. See pricing and start at livechatbot.in.
Frequently asked questions
How do I add live chat to Shopify without an app?
Copy your chat code from the LiveChatBot dashboard, open Online Store → Themes → Edit code → Layout/theme.liquid, and paste it just above the closing body tag. Save and check your store.
Will editing theme.liquid break my store?
Not if you paste one line in the right place. Duplicate your theme first so you can restore it instantly, and run the checker above before saving.
Why does the chat only show on my home page?
The code is probably inside a condition such as template.name == 'index'. Move it outside the if-block, just above the closing body tag.
Does the chat appear on Shopify's checkout?
No. Shopify hosts checkout pages separately from your theme, so theme.liquid code doesn't run there. Answer payment and COD questions on product and cart pages instead.
What happens when I update my theme?
The update may arrive as a separate theme without your code. Before publishing it, open its theme.liquid, check the chat code is there, and preview the store.
Keep reading
Related guides
Add Chatbot to Your Website When You Don't Know What It's Built On: Find Your Platform From the Page Source, Then Follow the Right Install Route (Free Platform Detector)
Add Chatbot to Website HTML Buttons: Open the Chat, Ask a Question or Pass a Logged-In Name From Your Own Code
Add Chatbot to Website in Stages: A Soft-Launch Plan That Tests Your Bot on Safe Pages First
Give shoppers somewhere to ask
One line in theme.liquid, answers for your store policies, and alerts on your phone. Start free on livechatbot.in.