HomeBlog & GuidesHow to Add Chatbot to Shopify
Shopify E-Commerce Tutorial by Knogents

How to Add an AI Chatbot to Shopify Website (Step-by-Step Guide)

Adding an AI chatbot to your Shopify store is one of the highest-converting upgrades you can make. But standard chatbots that only recite static text fall short. In this guide, you will learn how to configure an autonomous e-commerce AI agent in Knogents, select the exact right parameters, and embed it into Shopify Online Store 2.0 to automate product discovery, order tracking, and in-chat checkout.

Author:Knogents
•
8 min read
•
Verified for Shopify Online Store 2.0 (2026/2027)

Executive Summary: What We Will Build

By following this tutorial, your Shopify store will have an autonomous AI shopping and support agent powered by the official Shopify Integration by Knogents. Unlike a legacy FAQ widget, your agent will:

  • Search live catalog products by size & color
  • Verify real-time stock & eliminate hallucinations
  • Add items to cart & generate checkout links
  • Automate WISMO (Where Is My Order?) lookups
1

Step 1: Selecting the Right Parameters in the Knogents Dashboard

When creating your agent in Knogents, you will be presented with configuration settings. Choosing the right parameters determines how your bot interacts with shoppers and prevents ungrounded answers.

How to Add an AI Chatbot to Shopify (Step-by-Step Guide)
Parameter SettingRecommended ValueWhy Select This Parameter?
Display TypeFloating WidgetFloating widgets sit in the bottom-right corner of every page. This gives shoppers instant access on product pages, collection pages, and checkout landing screens without disrupting hero banners or mobile layout flow. (Use Inline only if creating a dedicated Help Center page).
Bot Title & Personae.g., "Aura Concierge" or "Store Assistant"Giving your agent an explicit, brand-aligned role increases customer engagement by up to 34%. Setting a clear subtitle (e.g. "24/7 Store Support & Product Search") sets the visitor's expectation immediately.
Similarity Threshold0.72 – 0.78 (Strict Grounding)This is the vector cosine distance required to consider a document relevant. A strict threshold prevents the AI from inventing shipping timelines, return windows, or discounts that do not exist in your uploaded policies.
Factual GroundingEnabled (True)Bounds every response strictly to your verified documentation. In e-commerce, knowledge-grounded accuracy protects your brand and builds consumer trust before buying.
Lead Capture & Email AlertsEnabled (Email + Consultation)Allows visitors to leave their contact details or schedule a meeting directly in chat if an inquiry requires personal operator attention.
2

Step 2: Connect the Shopify Storefront Integration

In your Knogents agent dashboard, click the Integrations tab and select Shopify. You have two connection methods:

Method A: 1-Click OAuth (Recommended)

Simply enter your your-brand.myshopify.com store domain and click Connect with Shopify. You will be redirected to approve permissions securely.

Zero API key handling required
Method B: Storefront Access Token

In Shopify Admin, go to Apps > App development > Create an app. Enable Storefront API read access and paste the public Storefront Access Token into Knogents.

Read-only customer-safe scopes

What Happens Automatically When Connected:

Knogents instantly mounts 7 native commerce tools into the LLM's runtime: search_products, get_product_details, add_to_cart, get_cart, update_cart, remove_from_cart, and create_checkout. When visitors ask for products or sizes, the AI queries live Shopify GraphQL endpoints instead of guessing.

3

Step 3: Copy Your Optimized Shopify Liquid Snippet

Navigate to the Deploy tab in Knogents and select Shopify. Knogents produces an asynchronous loader snippet configured with your unique botId:

layout/theme.liquid (before </body>)Liquid / HTML
<!-- Knogents AI Chatbot Widget -->
<script>
  window.widgetConfig = {
    chatbotId: "YOUR_CHATBOT_ID"
  };
</script>
<script
  async
  data-id="YOUR_CHATBOT_ID"
  id="knogents-widget-script"
  type="text/javascript"
  src="https://knogents.com/embed.js"
></script>
Script Loading Behavior: The async attribute ensures the Knogents script downloads asynchronously without blocking the HTML parser or interrupting page render execution.
4

Step 4: Paste into Shopify Theme Editor (layout/theme.liquid)

Now open your Shopify Store Admin in a new tab and follow these precise steps:

  1. A
    Navigate to Themes: In your Shopify admin sidebar, go to Online Store > Themes.
  2. B
    Open Code Editor: Beside your currently published active theme (e.g., Dawn, Debut, Prestige, Impulse), click the ... (three dots) action button and select Edit code.
  3. C
    Locate layout/theme.liquid: In the left-hand file browser under the Layout folder, click on theme.liquid.
  4. D
    Paste Before Closing Body Tag: Scroll down to the very bottom of the file. Find the closing </body> tag and paste your Knogents snippet right above it:
    <!-- Paste snippet here -->
    </body>
  5. E
    Click Save: Click the green Save button in the top right corner. Your agent is now live across your entire store!
5

Step 5: Verify & Test Live Storefront Capabilities

Because Shopify caches theme assets aggressively, open your live store URL in a new Incognito / Private window to verify your agent:

1. Check Widget Bubble

Verify the floating chat launcher appears in the bottom right corner with your custom theme colors and greeting.

2. Test Product Search

Ask: "Do you have black hoodies in size Large?" Verify the agent displays the interactive product card with real pricing and stock.

3. Test Direct Checkout

Say: "Add it to my cart and send me the checkout link." Verify the agent creates the cart and generates a 1-click checkout button.

Advanced Option: Embedding Inline on a Dedicated /pages/support Page

If you want an embedded chat window right in the middle of a dedicated Customer Service page (rather than a floating bubble), use Knogents' two-part inline integration:

// 1. Paste inside your Shopify Custom Liquid section on /pages/help:<div id="rag-inline-bot" style="width: 100%; min-height: 600px;"></div>
// 2. Paste script in theme.liquid with data-display="inline":<script src="https://knogents.com/embed.js" data-bot-id="YOUR_BOT_ID" data-display="inline" async defer></script>

Troubleshooting & Frequently Asked Questions

The chat bubble does not appear after saving theme.liquid. What should I do?

Shopify aggressively caches theme assets on their CDN. Open your store URL in an incognito window or append ?preview_theme_id=YOUR_THEME_ID to bypass the cache. Also ensure you placed the script before </body> and did not delete closing HTML tags.

Will the chatbot still work if I change or publish a new Shopify theme?

Because edits in theme.liquid are attached to that specific theme, if you publish a brand new theme in the future, simply repeat Step 4 to paste the 1-line script into the new theme's theme.liquid. Your bot configuration and knowledge base in Knogents remain untouched.

Does the AI know when a specific variant size is out of stock?

Yes! With the Shopify Integration by Knogents, Knogents queries live inventory quantities in real time. If a size Medium is sold out, it will explicitly inform the shopper and recommend available in-stock sizes.

Recommended Business Solutions

Discover autonomous AI solutions powered by these installation techniques.

Related Guides & Tutorials

Continue exploring practical guides to embedding and training your chatbot.

24/7 STOREFRONT ASSISTANT

Ready to Build Your AI Agent?

Train an AI chatbot on your website URLs, PDFs, and spreadsheets in 2 minutes with verified factual accuracy.

Free tier includes 100 messages/mo
No credit card required
Under 20 KB vanilla script