· 3 min read
How to build an AI assistant that answers from your Shopify store data
A plain-English guide to retrieval-augmented generation (RAG) for Shopify, covering what to index, how to keep it current, and how to stop it making things up.
A general AI chatbot knows a lot about the world and nothing about your store. Ask it whether your linen throw is machine washable and it will guess. An assistant built on your own data can look it up and point to where the answer came from.
The technique is called retrieval-augmented generation, or RAG. It sounds complicated, but the idea is simple: search first, then answer only from what you found.
Where to start
Start with an internal assistant for your support team rather than a customer-facing chatbot. Your team gets faster answers straight away, and you get weeks of real questions to test against before any customer sees it.
1. Choose your sources
Good sources are things that are true, written down and don’t change every minute:
- Products, variants and metafields (materials, sizing, care)
- Collections and product types
- Shipping, returns and refund policies
- FAQ pages, help center articles and size guides
- Past support replies your team is proud of (with personal details removed)
Orders are different. They change constantly and contain personal data, so don’t copy them into your search index. Instead, give the assistant a tool that looks up a specific order live through the Shopify Admin API, only when it’s needed and only for the customer in question.
2. Split, label and index
Break your content into sensible pieces: one product per piece, one policy section per piece, one FAQ answer per piece. Keep useful labels with each one, such as the page URL, the product ID and when it was last updated.
Then index it two ways:
- Meaning-based search (embeddings stored in a vector database such as pgvector) finds answers even when the customer’s wording differs from yours.
- Keyword search catches exact things like SKUs, sizes and product names, which meaning-based search can miss.
Using both together, often called hybrid search, gives noticeably better results than either alone.
3. Keep it fresh
An assistant quoting last season’s returns policy is worse than no assistant. Subscribe to Shopify webhooks for product, collection and page changes, and re-index the affected pieces when something changes. Run a full sync every night as a backstop, in case a webhook is missed.
4. Answer with guardrails
When a question comes in, the assistant searches, picks the most relevant pieces, and writes an answer using only those. Give it clear rules:
- Answer only from the sources provided, and link to them.
- If the sources don’t cover it, say so and offer to pass the question to a person.
- Never promise refunds, discounts or delivery dates that aren’t in the data.
Then build a test set: 50 to 100 real questions from your inbox, each with the answer your team would give. Run it every time you change anything, and track how many answers are correct, how many are honest “I don’t know”s, and how many are wrong. The wrong ones are the number to drive down.
5. Where Shopify Sidekick fits
Sidekick is the AI assistant built into the Shopify admin. Shopify now lets apps extend it: an app can make its own data searchable from Sidekick and offer actions that a merchant reviews and approves before anything changes.
That makes Sidekick a good home for internal questions (“which customers have an open return?”) without your team leaving the admin. A RAG assistant like the one above is the better fit for your support team’s helpdesk or for customers on your storefront. Many stores will end up with both, drawing on the same well-kept data.
What it takes to run
- Costs are mostly the AI service (charged per use) and a small database. For most stores, that’s modest next to the support time saved.
- Maintenance is mainly keeping sources accurate. If a policy is wrong on your site, the assistant will be wrong too, so treat it as a reason to tidy up your help pages.
- Privacy: use AI services that don’t train on your data, keep personal details out of the index, and look up order data live only when needed.
We’ve built assistants like this, and Sidekick extensions, before. If you’re wondering whether one would pay off for yours, our free Shopify AI audit will give you a straight answer.