Assistrio
Back

WordPress AI chatbot: add one to your site without touching code

On this page

To add a WordPress AI chatbot, copy the WordPress version of your chat code, paste it into the free Code Snippets plugin set to Run everywhere, and clear your cache. WPCode, Elementor and Divi also work, but only with the plain HTML code. Then check the chat in a private window on your phone.

Maybe you run a bakery with a small WooCommerce shop, and someone asked about delivery to Leeds at 11 pm with nobody around. You want a WordPress AI chatbot without another heavy plugin or a broken theme. The install is one snippet; the catch is that WordPress offers six places to put it, and caching plugins love to hide it. This guide covers only the WordPress part. If your agent isn't built and trained yet, start with our general guide to adding an AI chatbot to a website.

Key takeaways

  • A WordPress AI chatbot is a hosted chat window that answers visitors from your own content. On WordPress it needs one code snippet, not a full chatbot plugin.
  • Use the PHP snippet in the free Code Snippets plugin if signed-in WooCommerce customers or members should be recognized. WPCode, Elementor and Divi take plain HTML only.
  • Caching and speed plugins cause most "it's not showing" problems: purge every cache and exclude assistrio-chat.js from delayed or combined JavaScript.
  • Paste the code in one place only. Two places means two chat buttons.
A small online shop owner checks a parcel with her phone next to a laptop, the kind of store that uses a WordPress AI chatbot to answer order questions
Photo by Rifki Kurniawan on Unsplash

Which install method fits your WordPress AI chatbot?

Pick the method by one question: should the chat recognize people who are logged in? If yes, use Code Snippets with the PHP code; if not, any HTML method below looks the same to visitors.

Where you paste itCode to useRecognizes signed-in usersBest for
Code Snippets plugin (Snippets › Add New, Run everywhere)PHP snippet from Deploy › WordPress or WooCommerceYesWooCommerce stores and sites with member logins
WPCode (Code Snippets › Header & Footer › Footer)Plain HTML from Deploy › Chat WidgetNoSites that already manage tracking tags in WPCode
Elementor Pro Custom CodePlain HTMLNoSites built and managed entirely in Elementor Pro
Divi Theme Options › IntegrationPlain HTMLNoDivi sites that want no extra plugin
Child theme footer.phpPlain HTMLNoDevelopers who already maintain a child theme

Honestly, for most small sites the answer is Code Snippets. It's free, it survives theme switches, and it's the only option that tells your WordPress AI chatbot who a signed-in customer is, so "where's my order?" gets answered without asking for an email. Use one row only: the code should load once per page.

Installing it with the free Code Snippets plugin

Copy the WordPress version of the code from Assistrio, paste it into a new snippet set to Run everywhere, and save. It takes about 5 minutes with an admin login.

  1. 1

    Add your domain first

    In Assistrio, open your agent, click Deploy and pick WordPress (or WooCommerce) under Website builders. Add your domain under Allowed websites, for example northbakery.com. The https and www versions are covered, but a subdomain such as shop.northbakery.com needs its own entry, and each agent allows up to 3.

  2. 2

    Copy the code

    Click Copy code. It stays greyed out until at least one website is listed.

  3. 3

    Install Code Snippets

    In your WordPress admin, go to Plugins › Add Plugin, search for "Code Snippets", then install and activate it. It's free.

  4. 4

    Create the snippet

    Go to Snippets › Add New, name it "Assistrio chat widget" and paste the code.

  5. 5

    Run it everywhere

    Choose Run everywhere, then click Save and Activate.

  6. 6

    Purge every cache and look

    Clear your caching plugin, your host's cache and any CDN such as Cloudflare, then look for the chat button at the bottom right in a private window.

What you just pasted is a short PHP function hooked into wp_footer. It prints the chat code on every page and, when someone is logged in, signs their WordPress user ID with your agent's secret key on the server. So keep the snippet in Code Snippets, never in a post or a Custom HTML block, and replace it if you ever click Rotate on the key. Other changes (look, knowledge, welcome message) reach your site by themselves. The full walkthrough is in the WordPress install docs.

Using WPCode, Elementor, Divi or a child theme instead

These take HTML, not PHP, so copy the plain code from Deploy › Chat Widget (Install code › Copy Snippet) and paste it here:

  • WPCode: open Code Snippets › Header & Footer, paste into the Footer box and save.
  • Elementor Pro: go to Elementor › Custom Code › Add New Custom Code, paste, set the location to the end of <body> and publish with the condition Entire Site.
  • Divi: go to Divi › Theme Options › Integration, paste into the box that adds code to the body, and save.
  • Child theme: paste it just before </body> in the child theme's footer.php. Never edit the parent theme, since updates wipe it, and block themes have no footer.php, so use a plugin there.

Important

Pasted the PHP version into WPCode or a page builder? WordPress prints it as text on every page. Move it to Snippets › Add New.

Does a WordPress AI chatbot slow down your site?

Not in any way visitors will feel: the chat script loads asynchronously from Assistrio's CDN, so it doesn't block your page from rendering. The real risk is speed plugins delaying it until visitors never see it.

A WordPress chatbot plugin that stores chats on your server adds settings pages, database tables and another update to manage. A hosted WordPress AI chatbot keeps all of that outside WordPress. Trouble comes from optimisation plugins that rewrite your JavaScript:

Plugin settingWhat you'll noticeWhat to change
Delay JavaScript until the visitor interacts (WP Rocket, LiteSpeed Cache)The button appears only after a scroll or tapAdd assistrio-chat.js to the delay exclusions
Combine JavaScript (Autoptimize, W3 Total Cache)The chat stops loadingExclude assistrio-chat.js from combining
Page cacheVisitors get an older copy without the snippetPurge it after saving the snippet
CDN cache such as CloudflareWorks for you, not for customers elsewherePurge the CDN too

Test it like a visitor: open a private window on your phone, load a product or blog page and don't touch the screen for 10 seconds. If the button only shows up after you scroll, a delay setting is still catching it.

Turn it into a WooCommerce chatbot that knows your orders

Connect your shop once under Build › Actions in Assistrio, and the same chat can show products with live price and stock, change the real cart and look up order status with tracking. Signed-in customers are recognized automatically if you used the PHP snippet.

Picture two shoppers on a Tuesday evening. Maria is logged in and types "where's my order?" Because the Code Snippets install signed her user ID, your WordPress AI chatbot replies with her order status and tracking straight away. A guest types the same words and gets asked for the order number plus the email or phone you picked under Guests confirm with. Same chat, two safe paths.

  • Connect the shop: in Build › Actions, pick an action on the WooCommerce card, enter your shop's web address and approve Assistrio on WooCommerce's own screen while signed in as an admin.
  • Start read-only: switch on Retrieve and display orders and Retrieve and display products first. They answer questions and change nothing.
  • Add store changes later: Create order, Update cart, Create return or exchange and Tag an order change your shop, so each asks you to click Allow in WooCommerce first. Exchanges arrive as free orders on Pending payment, so nothing ships until your team sets them to Processing.

Plan around one limit: Free and Starter give each agent 5 actions and Pro gives 10 (see current plans), while Shopify and WooCommerce actions are on every plan, including the trial. Policy questions such as "can I return sale items?" still come from your Knowledge Base, and the WooCommerce integration page lists everything the connection does. Running a second store on Shopify? Our Shopify chatbot setup guide covers the same order flow there.

WordPress fixes when the chat button won't appear

Check the cache and the Allowed websites list first, because they explain most cases of a missing WordPress AI chatbot. Then work down this table.

What you seeLikely WordPress causeFix
Code printed as text at the bottom of pagesPHP snippet pasted into an HTML box (WPCode footer, Elementor, Divi)Move it to Snippets › Add New, or use the plain HTML code
Chat shows while you're logged in, not in a private windowPage cache serving logged-out visitors an old pagePurge the plugin, host and CDN caches
Chat appears only after scrollingA JavaScript delay settingExclude assistrio-chat.js from delay and combine settings
Works on the live site, not on stagingStaging subdomain missing from Allowed websitesAdd staging.yoursite.com as its own entry (it counts toward the 3)
Chat gone after a theme switchCode lived in the old theme's footer.phpMove it to Code Snippets
Can't install Code Snippets at allWordPress.com Free plan or free trial, which block pluginsUpgrade to a paid plan, or use Google Tag Manager if it already runs on the site
Snippet is there but still no chatVisibility switched off, or a script errorTurn on Visibility at the top of Deploy › Chat Widget, then check the browser console for an [Assistrio Chat] message

One quick test shows which side the problem is on: view the page source in a private window (Ctrl+U) and search for "assistrio". Not there? WordPress or a cache is the cause. There but invisible? The console message names what's missing. The WordPress integration page has a short checklist to forward to whoever runs your site.

What to do next

Set aside an hour this week and do these in order.

  • Choose your method from the first table. If you sell on WooCommerce or have member logins, pick Code Snippets with the PHP code.
  • Test a few real questions in the Playground, then add your live domain (and staging) under Allowed websites, install the snippet and purge every cache.
  • Test in a private window on your phone: wait 10 seconds without scrolling, ask three real customer questions and, on a shop, ask "where's my order?" once logged in and once as a guest.
  • Replacing an older chatbot plugin? Remove it only after the new chat passes those tests. If you're still comparing tools, see how Assistrio stacks up against one popular chatbot builder, or try Assistrio on its free trial with no credit card.

Frequently asked questions

Build your AI support agent with Assistrio

Upload files, add your website or connect Notion and Google Drive, and go live in minutes.