Free
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 manages 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 detailed breakdown of the setup, including prompt design, function integration, and advanced logic workflows, all aimed at creating a robust, user-friendly AI shopping assistant.
Key Components and Workflow Breakdown
Download Template:
https://www.uchat.com.au/templates/ahuppfxff9mboxqfg1ckkupia1lomtim
1. AI Agent Configuration
Aspect  | Details  | 
|---|---|
Agent Name  | Jane (Shopify Web Shop Assistant)  | 
Role & Persona  | A friendly, helpful virtual assistant guiding customers through browsing, selecting, and purchasing products.  | 
Core Responsibilities  | - Showcase product collections<br>- Display products within collections<br>- Manage shopping cart (add/remove/view items)<br>- Generate checkout links<br>- Handle open-ended questions about products and collections<br>- Provide product recommendations and detailed info  | 
Tone & Guidelines  | Clear, concise, supportive, and user-friendly responses.<br>Responses should use lists or tables for clarity.<br>Avoid storing customer data beyond session.  | 
2. Model Selection & Parameters
Parameter  | Setting  | Rationale  | 
|---|---|---|
Model  | Cloth (preferred for stability)  | Ensures consistent replies and better function triggering.  | 
Temperature  | 0.2  | Minimizes randomness, favoring precise responses.  | 
Frequency & Presence Penalties  | 0.5  | Reduces repetitive or overly generic replies.  | 
Auto Summarization  | After 20 messages  | Keeps context manageable during conversations.  | 
Token Limit  | Increased tokens  | Supports loading large product catalogs and detailed responses.  | 
3. Prompt Design & Skill Sets
The AI agent's prompt is crafted to guide behavior and trigger specific functions based on customer input:
Introduction & Greeting: Jane introduces herself and offers shopping assistance.
Browsing: Fetch and display collections, then products within selected collections.
Cart Management: Add, remove, or view cart items via dedicated functions.
Checkout: Generate a checkout link when the customer is ready.
Open-ended Questions: Handle inquiries about product types, features, or availability.
Product Recommendations: Suggest similar or related products based on customer questions.
Function Triggering: Use explicit prompts to invoke functions, ensuring stability across models.
4. Function Integration & Logic
The assistant relies on connected functions to interact with Shopify's API and perform actions:
Function  | Purpose  | Key Details  | 
|---|---|---|
Fetch Collections  | Retrieve live product collections  | Returns ID, title, description, image URL  | 
Fetch Products  | Get products within a collection  | Returns ID, title, description, images  | 
Manage Cart  | Add/remove/view cart items  | Uses product IDs and variants  | 
Generate Checkout Link  | Create a checkout URL  | Draft order creation, optional customer info  | 
Product Search & Recommendations  | Handle open-ended queries  | Match categories/products, provide info  | 
Constraints & Guidelines:
Responses must be clear, concise, and user-friendly.
Fetch data only when relevant to avoid unnecessary API calls.
Handle errors gracefully, offering alternatives or retry options.
Maintain session privacy; avoid storing customer data beyond current session.
4. Workflow & Implementation Details
Fetching and Displaying Collections
Trigger: Customer indicates interest in shopping.
Process:
Save customer preference (
customer_status = view_collections).Call
fetch_collections()function.Return a list or gallery of collections with images and descriptions.
Advanced Mode:
Display collections with a gallery view.
Allow customer to select a collection, then fetch products.
Fetching and Displaying Products
Trigger: Customer selects a collection.
Process:
Save selected collection ID.
Call
fetch_products()for that collection.Present products with images, descriptions, and options to add to cart.
Product Details:
Can include detailed info, tailored summaries, or specifications.
Support multiple product IDs for recommendations.
Managing the Shopping Cart
Adding Products:
Triggered when customer chooses to add an item.
Save product ID and variant info.
Call
add_to_cart()function.
Removing Products:
Triggered when customer requests removal.
Use product variant ID to remove.
Viewing Cart:
Fetch current cart items.
Display in list or table format.
Handling Cart State:
Save cart state in session variables.
Use custom fields to track cart status (
customer_status = cart).
Generating Checkout Links
Trigger: Customer indicates readiness to purchase.
Process:
Call
create_checkout()function.Generate a draft order and retrieve checkout URL.
Present checkout button to customer.
Post-Checkout:
Clear session data for privacy.
Confirm order placement.
Handling Open-Ended Questions
Examples:
"Do you have any backpacks?"
"Tell me more about the AirPods."
Implementation:
Use AI to match keywords to categories or products.
Fetch relevant collections or product info.
Respond with summaries, images, or detailed descriptions.
Matching Logic:
Fetch all collections.
Use AI to match customer input to collection/product names.
Return relevant items with IDs for further actions.
Product Recommendations & Detailed Info
When a customer asks for more info:
Trigger
product_info()function.Return concise descriptions, features, or specifications.
When customer wants to add a product to cart:
Save product ID in a custom variable.
Trigger cart addition function.
Confirm addition with a message.
5. Advanced Features & Custom Logic
Open-Ended Search & Matching
Challenge: Handling vague or complex queries.
Solution:
Fetch all collections and products.
Use AI to match customer input to relevant categories or products.
Return matching collection IDs or product IDs.
Example:
Customer: "Do you sell waterproof backpacks?"
AI matches "backpack" to collection, filters for "waterproof" features.
Returns matching products or collection info.
Multi-Product Handling
Support multiple product recommendations in a single reply.
Use comma-separated product IDs for batch actions.
Enable dynamic responses based on customer preferences.
Error Handling & Graceful Fallbacks
Detect unavailable products or invalid cart actions.
Offer alternatives or suggest trying again.
Use consistent response formats (lists/tables) for clarity.
Privacy & Session Management
Optional: Clear AI message history after session.
Best Practice:
Do not store customer data beyond session.
Use session variables and custom fields to track current state.
Ensure GDPR/HIPAA compliance if applicable.
Summary
Creating a Shopify AI web shop assistant involves meticulous setup of prompts, functions, and workflows to ensure a smooth, intuitive shopping experience. By combining core e-commerce functionalities with advanced open-ended question handling, the assistant can serve both casual browsers and detailed product inquiries effectively. The detailed template and logic outlined here provide a solid foundation for deploying a robust AI-driven storefront that enhances customer engagement and streamlines sales.