Install guides · Shopify

Shopify chatbot

Add a chatbot to your Shopify store

Alma goes into a Shopify store as a chat window, through one edit to one theme file. It is not a Shopify app and has no connection to your Shopify data, so start with what it can and cannot do in a store.

Where the code goes
theme.liquid, just above the closing </body> tag
Before you start
A purchased theme and a backup copy of it
Only some pages
A Liquid condition around the code

What Alma can and cannot do in a Shopify store

Alma cannot see carts, orders, customers or inventory, and it does not process payments. With no Shopify integration, it cannot tell a shopper where an order is, check stock, or change a price.

What it does is hold the conversations you write in its flow builder: answers to your common questions about shipping, returns and sizing, buttons that open a product or collection page in a new tab, or a discount code you have written into the chat. When a shopper needs more help, it can take their email address or phone number and email the lead to the address you set for lead alerts, so the question gets answered instead of abandoned. On the Growth plan and up, Zapier can pass each lead to other apps.

Before you edit your theme

Shopify's own instructions for editing theme code say you can edit a theme's code only after you have purchased it, including a trial version of a paid theme, and recommend duplicating the theme as a backup first. Alma is not a Shopify app, so it is not listed under App embeds in the theme editor; its code goes into the theme itself.

Add Alma to theme.liquid

theme.liquid is your theme's default layout, which Shopify's developer documentation describes as the base of the theme for pages other than checkout, so code placed there reaches your storefront pages.

  1. In Alma, open your bot's Settings page, find the Embed Code section and click Copy Code.
  2. In your Shopify admin, go to Online Store.
  3. Find your current theme, click the … button to open its actions menu, and click Edit code.
  4. In the Layout folder, click theme.liquid.
  5. Search the file for </body> with Ctrl + F (Command + F on a Mac). It is near the end of the file.
  6. Paste the embed code on a new line just above </body>.
  7. Click Save.
The embed code as your bot's Settings page shows it. Your copy has your bot's ID where this one says YOUR-BOT-ID.
<script>
  (function(w,d,s,o,f,js,fjs){
    w['AlmaChat']=o;w[o]=w[o]||function(){(w[o].q=w[o].q||[]).push(arguments)};
    js=d.createElement(s),fjs=d.getElementsByTagName(s)[0];
    js.id=o;js.src=f;js.async=1;fjs.parentNode.insertBefore(js,fjs);
  }(window,document,'script','alma','https://www.helloalma.chat/widget/widget.js'));
  alma('init', 'YOUR-BOT-ID');
</script>

If you change your mind, the code editor's Timeline view can restore theme.liquid to an earlier version.

Build the chatbot first, then paste it in.

Start the 14-day trial, choose one of the templates, write your welcome message, and copy your embed code into Shopify with the steps above.

Show the chat on only some pages

Alma has no setting that limits the chat to certain pages, and theme.liquid reaches them all. To narrow it down, wrap the embed code in a Liquid condition, the same kind of check Shopify's help center uses in theme.liquid to hide pages from search engines. To show the chat on product pages only:

{% if template contains 'product' %}
  (paste the Alma embed code here)
{% endif %}

For a single page, test its handle (the last part of its web address) instead: {% if handle contains 'contact' %}.

Check that it is working

Open your store in a private or incognito window. A round chat button should sit in the bottom right corner, or bottom left if you chose that under Widget Position in Alma, and clicking it opens your welcome message. If it is missing, check that you edited the published theme rather than the backup, that the whole embed code is there, and that your Alma trial or plan is active. Your browser's developer tools show "Alma Chat initialized" in the Console tab when the chat loads.

After a theme update, or a new theme

Shopify carries code edits into an updated theme only when they do not conflict with it. If the theme card says "Theme added: code edits could not be included", paste the embed code into the new version's theme.liquid. If you publish a different theme, add the code to that theme too.

Shopify's own documentation

If a step above no longer matches what you see, Shopify's own pages have the current version:

Shopify questions

Shopify chatbot FAQ

Can Alma see my Shopify orders or carts?

No. Alma has no Shopify integration. It cannot see carts, orders, customers or inventory, so it cannot look up an order or check stock. It works from the conversations you write in Alma's flow builder.

Does Alma take payments or apply discounts?

No. Alma does not process payments and cannot change prices or carts. A chat can show a discount code you have written into it, and the shopper enters that code at checkout as usual.

Is Alma a Shopify app?

No. Alma is not in the Shopify App Store and is not listed under App embeds in the theme editor. You add it by pasting its embed code into your theme's theme.liquid file.

Will the chat window appear at checkout?

Do not expect it there. Shopify customizes checkout, thank you, order status and customer account pages in a separate checkout and accounts editor, apart from your theme, and Alma's code goes into the theme.

What happens to the code when I update my theme?

Shopify keeps code edits in the updated theme when they do not conflict with the update, and the theme card says whether they were included. If they were not, paste the embed code into the updated theme's theme.liquid again.

Other platforms

Start the trial

Put Alma on your Shopify site.

The trial lasts 14 days with the Starter plan's limits: 1 chatbot and up to 1,000 subscribers. Build your chatbot, paste the embed code where this guide shows, and the next visitor with a question can get an answer while you are busy with something else.

Trial
14 days
Plans
From $29 a month
Install
One embed code