theme.liquid file — the root layout that wraps every storefront page. Edit it directly in the Shopify admin code editor.
1
Open the theme code editor
In your Shopify admin, go to Online Store → Themes. Find your active theme, click the three-dot menu (…), and select Edit code.
2
Open theme.liquid
In the file tree on the left, under Layout, click theme.liquid to open it in the editor.
3
Paste the snippet before </body>
Locate the closing Replace
</body> tag near the bottom of the file. Paste the widget snippet immediately before it:theme.liquid
kb_xxx and bq_pk_... with your actual values.4
Save and preview
Click Save in the top-right corner. Open your storefront in a browser (or use Online Store → Themes → Preview) and verify the “Ask AI” launcher appears on the page.
If your store uses multiple themes (e.g. a development theme and a live theme), you need to add the snippet to each theme’s
theme.liquid separately — or use a Shopify Script Tag via the Admin API if you manage themes programmatically.Get your keys — your knowledge base ID and public client key (
bq_pk_...) are in the BeforeQuery dashboard under Knowledge Base → Integration. Add your Shopify store’s domain (e.g. yourstore.myshopify.com or your custom domain) to the key’s origin allowlist.