UChat Official

Introduction

In this comprehensive overview, we explore the process of creating a Shopify AI-powered web shop assistant capable of delivering a seamless shopping experience.

This assistant, named Jane, is designed to handle core e-commerce functionalities such as fetching categories, displaying products, managing the shopping cart, and facilitating checkout. Beyond these basics, it also addresses open-ended customer inquiries like "Do you have any backpacks?" or "Tell me more about those AirPods," which are notably more complex to implement.

This guide provides a step-by-step breakdown of the setup, including the prompt design, function integrations, and workflow logic. It emphasizes the importance of stability and consistency in AI responses, especially when handling dynamic shopping interactions. The goal is to equip you with a robust template that can be customized to your store's needs, ensuring a smooth customer experience powered by AI.

Building the Shopify AI Assistant — Key Components

1. Defining the AI Agent Prompt

Aspect

Details

Agent Name

Jane (Shopify Web Shop Assistant)

Role & Responsibilities

- Showcase product collections<br>- Display items within collections<br>- Manage shopping cart (add/remove items)<br>- Provide checkout links<br>- Handle open-ended questions about products or collections<br>- Offer product recommendations and info

Persona & Tone

Friendly, helpful, clear, concise, supportive tone

Skill Sets & Workflow

Sequentially structured to guide the conversation from greeting to shopping actions

The prompt sets the persona, skills, and constraints, ensuring the AI responds appropriately and triggers the correct functions.

2. Model Selection & Parameters

Parameter

Setting

Purpose

Model

cloth (preferred for stability)

Ensures consistent, reliable replies

Temperature

0.2

Keeps responses focused and reduces randomness

Frequency Penalty

0.5

Discourages repetitive responses

Presence Penalty

0.5

Promotes diversity in replies

Auto Summarization

Enabled after 20 messages

Maintains context clarity

Token Limit

Increased

Supports loading large product catalogs

Choosing the right model and parameters is crucial for response stability and function triggering accuracy.

3. Structuring Skill Sets & Conversation Flow

The assistant's workflow is divided into distinct skill sets, each triggered based on customer input:

  • Introduction & Greeting
    Jane introduces herself and asks if the customer wants to shop or inquire.

  • Fetching & Displaying Collections
    Triggered when the customer indicates shopping intent. Fetches live collections from Shopify, displaying ID, title, description, and images.

  • Fetching & Displaying Products
    Once a collection is selected, fetches relevant products, presenting key details and images.

  • Managing Cart Operations
    Handles add, remove, and view cart actions, triggering corresponding functions.

  • Providing Checkout Links
    When ready, generates a checkout URL for the customer to complete purchase.

  • Handling Open-Ended Questions
    For inquiries like "Tell me about backpacks," the assistant searches Shopify collections and products, matching categories or specific items, and provides detailed info.

  • Product Recommendations & Info
    When customers ask about products, the assistant fetches relevant data, suggests alternatives, or provides detailed descriptions.

This structured approach ensures the AI responds logically and triggers the correct backend functions.

4. Function Integration & Logic

The assistant relies on dedicated functions for each task, such as:

Function

Purpose

Key Details

Fetch Collections

Retrieve live product categories

Returns ID, title, description, image URL

Fetch Products

Get products within a collection

Returns ID, title, description, images

Add to Cart

Add selected product variant

Uses product ID and variant info

Remove from Cart

Remove specific item

Uses product variant ID

View Cart

Display current cart items

JSON format for clarity

Create Checkout Link

Generate checkout URL

For customer to finalize purchase

Product Search

Handle open-ended queries

Match categories or specific products

All functions are designed to be triggered explicitly by the AI based on conversation context, ensuring predictability and accuracy.

5. Managing Customer Session & Privacy

  • Session Handling:
    The assistant tracks customer status via custom parameters (e.g., categories fetched, products fetched, checkout ready) to guide the flow.

  • Privacy & Data Handling:
    The assistant does not store customer data beyond the session. For GDPR or HIPAA compliance, session clearing is recommended after interactions.

  • Error Handling:
    Responses gracefully handle issues like product unavailability or invalid cart actions, offering alternatives or prompts to retry.

6. Advanced Logic & Workflow

Fetching Collections & Products

  • Fetch Collections:
    Searches for published collections with minimal payload (ID, title, description, image).
    Example:

    {
      "id": "123",
      "title": "Backpacks",
      "body_html": "Stylish backpacks for all occasions",
      "image": {"src": "https://linktoimage.com/backpack.jpg"}
    }
  • Fetch Products:
    Based on selected collection, retrieves relevant products with key details, supporting multiple images if needed.

Handling Open-Ended Questions

  • Matching Categories:
    Uses AI to interpret customer queries, matching keywords to collection names (e.g., "backpacks" → Backpack collection).

  • Product Details:
    For specific inquiries, fetches detailed product info, including descriptions and images, formatted for clarity.

Managing Cart & Checkout

  • Add/Remove Items:
    Uses product variant IDs to modify cart contents, updating the cart display dynamically.

  • Generate Checkout:
    Creates a draft order, then provides a checkout URL with a call-to-action button ("Checkout Now") for seamless purchase completion.


Final Thoughts

Building a Shopify AI web shop assistant involves careful prompt design, precise function integration, and workflow management. The approach outlined ensures the assistant can handle core shopping tasks while also managing complex open-ended questions with stability and consistency.

By leveraging structured skill sets, custom parameters, and smart function triggers, you can create a responsive, user-friendly AI assistant that enhances your online store's customer experience. Remember to prioritize privacy, error handling, and session management to maintain trust and compliance.

This template serves as a solid foundation—customize it further to match your store's unique catalog and branding. With this setup, your Shopify store can offer personalized, efficient, and engaging shopping interactions powered by AI.