Turn storefront visitors into buyers with 24/7 product advice, stock checks, and checkout assistance.
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.
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
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.
| Parameter Setting | Recommended Value | Why Select This Parameter? |
|---|---|---|
| Display Type | Floating Widget | Floating 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 & Persona | e.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 Threshold | 0.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 Grounding | Enabled (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 Alerts | Enabled (Email + Consultation) | Allows visitors to leave their contact details or schedule a meeting directly in chat if an inquiry requires personal operator attention. |
Step 2: Connect the Shopify Storefront Integration
In your Knogents agent dashboard, click the Integrations tab and select Shopify. You have two connection methods:
Simply enter your your-brand.myshopify.com store domain and click Connect with Shopify. You will be redirected to approve permissions securely.
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.
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.
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:
<!-- 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>async attribute ensures the Knogents script downloads asynchronously without blocking the HTML parser or interrupting page render execution.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:
- ANavigate to Themes: In your Shopify admin sidebar, go to Online Store > Themes.
- BOpen Code Editor: Beside your currently published active theme (e.g., Dawn, Debut, Prestige, Impulse), click the ... (three dots) action button and select Edit code.
- CLocate layout/theme.liquid: In the left-hand file browser under the Layout folder, click on
theme.liquid. - DPaste 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> - EClick Save: Click the green Save button in the top right corner. Your agent is now live across your entire store!
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:
Verify the floating chat launcher appears in the bottom right corner with your custom theme colors and greeting.
Ask: "Do you have black hoodies in size Large?" Verify the agent displays the interactive product card with real pricing and stock.
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:
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.
Explore Related E-Commerce & AI Guides
Recommended Business Solutions
Discover autonomous AI solutions powered by these installation techniques.
Automated WISMO Order Tracking
Automate Where Is My Order inquiries with Order Number and Email verification on Shopify.
Guide shoppers to the perfect items using tabular catalog search and natural language discovery.
Related Guides & Tutorials
Continue exploring practical guides to embedding and training your chatbot.
How to Automate Shopify Order Tracking (WISMO)
Configure Storefront API verification to deliver real-time fulfillment status and courier links.
How to Build an AI Shopping Assistant
Implement in-chat cart creation, live stock checks, and 1-click checkout URLs for Shopify.
How to Train an AI Chatbot on Excel & CSV Files
Preserve column headers across table chunks to eliminate pricing and SKU hallucinations.
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.