Deploy to your website

Add an AI Chatbot to WooCommerce

Add an AI chat widget to your WooCommerce store with Code Snippets, recognize signed-in customers, and let the agent show products, carts, and orders.

WooCommerce runs on WordPress, so the code goes in with the free Code Snippets plugin and the chat shows on every page, including the shop, cart, and checkout. It already recognizes customers who are signed in. Then connect your store so the agent can show products, change the cart, and track orders.

What you need

  • A WordPress admin account (to install plugins).
  • Your store's address. Your shop should load over https://.
  • About 5 minutes.

Before you start

  1. 1

    Open Deploy

    In Assistrio, open your agent and click Deploy in the top bar. Pick WooCommerce under Website builders.

  2. 2

    Add your website

    Under Allowed websites, add your site's address. The chat only loads on websites you add here, and Copy code stays off until you add one. Just the domain is enough — https:// and www are covered for you. See Allowed websites.

  3. 3

    Copy the code

    Click Copy code in the steps. It's the normal Chat Widget code — there's no app or plugin of ours to install.

Deploy

Deploy on

Chat WidgetEmbed a floating Chat Widget on any website.
IframeEmbed the agent as an inline element on any website.

Website builders

Shopify
WooCommerce
WordPress
Wix
Webflow
Squarespace
Framer
BigCommerce
More platforms in the user guide

Other channels

Center StageA large chat in the middle of your website, with its own install code.
Help pageA full-page chat with its own link.
SlackYour team asks the agent in Slack.
EmailYour agent answers customer emails.
Deploy in the top bar: your platform is under Website builders, other channels below.

Add it in WooCommerce

  1. 1

    Install Code Snippets

    In your WordPress admin, go to Plugins › Add Plugin, search “Code Snippets”, then install and activate it (it's free).

  2. 2

    Add a snippet

    Go to Snippets › Add New, give it a name like “Assistrio Chat Widget”, and paste the code.

  3. 3

    Run it everywhere

    Choose Run everywhere and click Save and Activate. If you use a caching plugin, clear its cache.

Code Snippets · Add New

Snippets › Add New

Save and Activate
Code — then choose Run everywherePaste here
1add_action('wp_footer', function () {
2 $assistrio_secret = '••••••••';
3 $assistrio_user = is_user_logged_in() ? 'woocommerce:' . get_current_user_id() : '';
4 ?> <!-- Chat Widget code, signed --> <?php
5});
Active — signed-in customers are recognized
Snippets › Add New: paste the code, choose Run everywhere, then Save and Activate.

Check it works

  • Open your store in a private (incognito) window, so you see what visitors see: the chat button shows at the bottom right of every page.
  • Click it and send “Hi” — your agent answers. Chats you start here show in Activity › Chat logs.
  • Change the look or welcome message any time in the Playground — no need to paste the code again.
yourstore.com
ACMEShopSaleCart
NovaWe reply in a few minutes

Hi! 👋 How can I help you today?

Type a message…
The result: the Chat Widget at the bottom right, open on top of your page.

Signed-in customers are recognized

The code from Deploy › WordPress (or WooCommerce) is a short PHP snippet: it adds the Chat Widget to every page and, for customers who are signed in, signs their user ID on your server with the agent's secret key. So order lookups, account changes, and returns work without asking for an email. Guests chat as usual. That's why it goes in Code Snippets — it has to run as PHP.

What the snippet looks like
add_action('wp_footer', function () {
  $assistrio_secret = 'YOUR_SECRET_KEY';
  $assistrio_user = is_user_logged_in() ? 'woocommerce:' . get_current_user_id() : '';
  ?>
  <!-- the Chat Widget code, with userId and userHash for signed-in customers -->
  <?php
});
  • The key is under Secret key in the same Deploy panel (“Already in your snippet”). If you click Rotate, copy the code again and replace the snippet.
  • Your key is inside the snippet — keep it in Code Snippets, never in a page, a post, or a public place.

Prefer WPCode or a page builder?

Those take HTML, not PHP. Copy the plain code from Deploy › Chat Widget (Install code › Copy Snippet) instead, and paste it into WPCode's Code Snippets › Header & Footer › Footer, Elementor's Custom Code, or Divi's Integration box. The chat works the same — but signed-in customers aren't recognized this way.

WPCode · Header & Footer

Code Snippets › Header & Footer

Save Changes
FooterPaste here
1<link rel="stylesheet" href="…/assistrio-chat.css" />
2<script>window.AssistrioChatConfig = { agentId: "…" };</script>
3<script src="https://widget.assistrio.com/assistrio-chat.js" async></script>
Saved — clear your cache, then reload
WPCode's Header & Footer: the plain HTML code goes in Footer.

Let the agent sell and support

Connect your store once under Build › Actions: pick an action on the WooCommerce card, enter your shop's web address, and approve Assistrio on WooCommerce's own screen (you need to be signed in as an admin). Then the agent can show products as cards, read and change the shopper's real cart (the chat uses your store's own cart, so most themes' mini-carts update too), create orders, track orders, and handle returns and exchanges.

Note

Every action and setting is in Shopify & WooCommerce actions. WooCommerce exchanges are created as free orders left on Pending payment, so nothing ships until your team sets them to Processing.

Not showing?

  • Using a caching or speed plugin (WP Rocket, LiteSpeed Cache, W3 Total Cache, Autoptimize)? Clear its cache. If it delays JavaScript until the visitor interacts, the chat only shows after a scroll or click — exclude assistrio-chat.js from delay and combine settings.
  • The code shows up as text on your pages? The PHP snippet was pasted somewhere that takes HTML (WPCode's footer, a page builder). Move it to Snippets › Add New.
  • Check the address under Allowed websites is the one in your browser's address bar. A different subdomain (like shop.example.com) needs its own entry. Each agent can have up to 3.
  • Check the Chat Widget's Visibility is on (top of Deploy › Chat Widget).
  • Two chat buttons? The code is on the page twice (for example in the theme and in a plugin) — remove one.
  • Still nothing? Open the browser console (right-click › Inspect › Console) and look for an [Assistrio Chat] message: it says what's missing. More fixes in the FAQ.

Stuck? Ask AI to walk you through it

Pick ChatGPT, Claude, or Gemini and paste the prompt (or click Open in… to start the chat with it typed in). It will guide you click by click in WooCommerce — and help if your screens look different (older plans, other languages, a different theme).

AI assistant you use

I want to add a chat widget to every page of my WooCommerce site. I have a short snippet of HTML code (a <link> and two <script> tags) from Assistrio.

It needs to go as a PHP snippet with the free Code Snippets plugin: Snippets › Add New, paste, choose Run everywhere, Save and Activate.

Please walk me through it one click at a time, and wait for me to say "done" before the next step. Ask me what I see if my screen doesn't match.
At the end, tell me how to check it works in a private window, and what to do if the chat button doesn't show.
Open in ChatGPT

Update or remove it

  • Changes in Assistrio (look, knowledge, actions, welcome message) show on your site by themselves. You don't paste the code again.
  • Paste it again only if you Rotate the secret key (the Shopify, WordPress, and WooCommerce codes are signed with it), or if you move the code to a new theme or template.
  • To remove it, delete the code from Snippets (deactivate or delete the snippet) and save (and publish). To hide it without touching your site, turn off Visibility at the top of Deploy › Chat Widget — as long as another channel is on, since at least one channel must stay on.

Center Stage

Want Center Stage — the “Ask AI” box at the bottom center — instead, or as well? Pick Center Stage in the Playground, open Deploy, and pick WooCommerce under Center Stage. The steps are the same with its code. If the Chat Widget code is already there, keep it and paste Center Stage's next to it.

Next steps

Was this page helpful?

Need help? Contact support — we reply within one to two business days.