- Load the UI Kit Builder bundle on page load
- Initialize CometChat with your App ID, Region & Auth Key
- Automatically log in each visitor (using their Shopify
customer.idor “guest”) - Launch a docked chat UI on every page
What You’ll Build
A persistent, docked chat widget in your Shopify theme—fully configurable via Theme Settings or a snippet/app block.Quick Steps to Embed CometChat Widget
1
Register on CometChat & Gather Your Keys
Before you start, sign up at the CometChat Dashboard and create an app. Copy:
- App ID
- Region
- Auth Key
2
Paste the CometChat Embed Block
- In Shopify Admin, go to Online Store → Themes → … → Edit code.
- Open layout/theme.liquid (or the snippet/section where you want the widget).
- Near
</body>, paste the full block below. It loads the SDK, injects Shopify customer data, and initializes the widget:
3
Turn on Customer Accounts (recommended)
{{ customer.id }} and {{ customer.first_name }} only populate when Shopify customer accounts are enabled and the visitor is logged in.- In Shopify Admin, go to Settings → Customer accounts.
- Choose Classic customer accounts → Optional (or Required) and save.
- Log in as a test customer, reload your storefront, and confirm the widget now shows the real shopper name. If no one is logged in, the script safely falls back to
guest_<timestamp>.
4
(Optional) Expose Credentials in Theme Settings
To let non-developers manage credentials from the Shopify Theme Editor, add this section in config/settings_schema.json (just before the final
]):5
(Advanced) Use an Online Store 2.0 App Block
If your theme supports Shopify 2.0 app blocks, you can make a reusable section:
- Online Store → Themes → Edit code
- Under Sections, click Add a new section →
cometchat-widget.liquid - Paste the snippet from the previous step into that file.
- Save, then add it in Customize theme under App embeds or as a section on any template:
Advanced JavaScript APIs
Once the widget is loaded, interact with it via the globalCometChatApp object:
Chat and Call Methods
UI Event Listeners
User and Group Management
Authentication Methods
Storage Methods
Localization
With language localization, our Chat Widget adapts to the language of a specific country or region. Chat Widget allows you to detect the language of your users based on their browser settings and set the language of the widget accordingly. You can also set the language manually using theCometChatApp.localize method.
The CometChat App supports localization for multiple languages, allowing you to provide a tailored experience for users across different regions.
You can find the list of supported languages and their corresponding language codes below:
| Language | Code |
|---|---|
| English (United States) | en-US |
| English (United Kingdom) | en-GB |
| Dutch | nl |
| French | fr |
| German | de |
| Hindi | hi |
| Italian | it |
| Japanese | ja |
| Korean | ko |
| Portuguese | pt |
| Russian | ru |
| Spanish | es |
| Turkish | tr |
| Chinese | zh |
| Chinese (Traditional) | zh-TW |
| Malay | ms |
| Swedish | sv |
| Lithuanian | lt |
| Hungarian | hu |
- JavaScript
| Parameter | Description | Type |
|---|---|---|
| LANGUAGE_CODE | The language code the texts to be translated into | Required |
Troubleshooting
- Widget not appearing?
- Confirm the embed script loads (check Network tab for
chat-embed@1.x.x) - Ensure the
<div id="cometChatMount"></div>exists once per page and is not hidden by theme CSS
- Confirm the embed script loads (check Network tab for
- Only guest IDs show up?
- Customer accounts must be enabled, and you need to preview as a logged-in shopper—not inside the Theme Editor preview
- Inspect
window.CURRENT_USER_ID/window.CURRENT_USER_NAMEin the console to confirm Shopify is populating them
- Login or user-creation errors?
- Use an App Auth Key (not REST API key) so
CometChatApp.createOrUpdateUsercan run - Check the Users tab in your CometChat Dashboard to ensure the UID being generated does not violate UID rules
- Use an App Auth Key (not REST API key) so