# Shopify (https://notert.io/docs/platforms/shopify)

Last updated 2026-11-24

Your store's theme draws its pages from one layout file, `theme.liquid`, so the snippet goes there once. A few lines of Liquid beside it can tell your team which customer is writing and what's in their cart.

## Before you start [#before-you-start]

- **Copy your snippet.** In <Key to="settings">Settings</Key>, open <Key to="settings/conversations">General</Key> under Conversations and switch <Key>Conversations</Key> on if it's off. Then open <Key to="settings/conversations/widget">Widget</Key>, press <Key>Open guide</Key>, and copy it under Add it to your site. See [install the widget](/docs/getting-started/install-the-widget).
- **List your store's address.** Under Where it works in the install guide, check your store's domain is covered. See [your store's addresses](#your-stores-addresses) below.
- **Who can edit theme code.** In Shopify, you need the store owner's account, or staff permission to edit themes.

## Add the snippet [#add-the-snippet]

<Steps>
1. In your Shopify admin, open **Online Store**, then **Themes**.
2. Beside your current theme, open its menu, the key with three dots, and choose **Edit code**.
3. Under **Layout**, open `theme.liquid`.
4. Paste your snippet just before `</body>`, near the end of the file, and press **Save**.
5. Open your store. The round button appears in the corner once the page has loaded, and within moments the install guide's Check it's live shows your store's address.
</Steps>

## Your store's addresses [#your-stores-addresses]

The widget only answers on the websites listed under Where it works in the install guide. Add your store's own domain there, such as `acme.com`, which covers `www.acme.com` and every other subdomain.

If customers also reach your store at its `myshopify.com` address, add that address too, in full, such as `acme.myshopify.com`. The install guide won't add `myshopify.com` on its own, since a website covers its subdomains and the widget would then answer on every store there. See [where the widget works](/docs/widget/where-it-works).

## Tell your team who's writing [#tell-your-team-whos-writing]

Your store knows which customer is signed in and what's in their cart. Liquid can write that into the page for [`context`](/docs/widget/javascript-api#context), which sends it with the customer's next message, and your team reads it beside the conversation under "From the page". Paste this after the snippet in `theme.liquid`:

```liquid
<script>
  window.notert.context({
    {% if customer %}
      shopifyCustomerId: {{ customer.id | json }},
      orders: {{ customer.orders_count | json }},
    {% endif %}
    cartItems: {{ cart.item_count | json }},
    cartTotal: {{ cart.total_price | money_without_currency | json }}
  });
</script>
```

Each key is your choice, starting with a letter, and each value a short text, a number or `true` or `false`. A cart changed without a reload, as many themes' drawers do, leaves `cartItems` as the page was drawn until the next page. Call `window.notert.context(...)` again from your theme's cart code to keep it current.

<Note>
What `context` carries is the page's word, unverified: anyone can call it from the browser, so
your team sees it as a hint, never as who the customer is. To have Notert know a customer for
certain, your server signs a token for [`identify`](/docs/signed-in-users/identify-users), which
takes a server of your own, not a theme alone.
</Note>

## Open it from your own button [#open-it-from-your-own-button]

To open the widget from a Contact us link rather than the round button, pick <Key>Your own button</Key> in the install guide and paste that snippet instead, which leaves out the round button. Then give any link or button the attribute, in your theme's code or in a **Custom Liquid** section added in the theme editor, in themes that offer one:

```html
<button type="button" data-notert-toggle="new">Contact us</button>
```

`new` opens a new conversation. See [your own button](/docs/widget/javascript-api#your-own-button) for the other screens it can open.

## Good to know [#good-to-know]

- **The code belongs to the theme.** If you switch to another theme, or install a new copy of yours, paste the snippet into its `theme.liquid` too. An update to your theme can arrive as a fresh copy without your edits, so check the snippet is still there after one.
- **Checkout is Shopify's own page.** It isn't drawn from your theme's layout, so the widget shows on your storefront but not at checkout.
- **A password-protected store** shows visitors its password page, which comes from another layout file, so the widget isn't there either until the store opens.
- **Previews.** Before you publish a theme, check it where the widget answers: on a theme preview at an address listed under Where it works. The console says when a page's address isn't covered.

If the widget doesn't appear on your store, open the browser's console and look for a line starting `Notert:`, which says why. See [troubleshooting](/docs/widget/troubleshooting).