Blog

How to add a custom AI chatbot to your WooCommerce store

· 7 min read

WooCommerce is WordPress with a shop on top, so the way you add an AI chat assistant is exactly the way you'd add one to any WordPress site: one line of code, pasted once. What's different for a store is what the assistant should know, and a couple of caching settings that catch shops out.

This guide uses Pixexl's assistant as the example, but the steps are the same for most chat tools that give you a script tag.

Before you start

You'll need three things:

  • Admin access to your WordPress site. Shop managers can't add scripts.
  • Your chat's embed code. In Pixexl, it's on your project's Settings tab, under the integration code. It looks something like this:
<script
  src="https://…/pixe-widget.js"
  data-project-id="your-project-id"
  data-api="https://…"
  async
></script>
  • Your domain added to the project. For security, the chat only runs on domains you've allowed. If your store also runs on a staging address, add that too.

Add the code

There are three ways, all covered step by step in How to add a custom AI chatbot to your WordPress website:

  1. A header and footer code plugin, such as WPCode. Paste the code in its Footer box. This is the one we recommend: it doesn't depend on your theme.
  2. A Custom HTML block in the footer, if your store uses a block theme (Appearance → Editor → Patterns → Footer).
  3. Your child theme's functions.php, hooked to wp_footer, if you look after the code yourself.

Whichever you pick, the code ends up on every page, including the shop, product, cart, checkout and account pages WooCommerce adds. Open your store in a new tab and the chat button should appear in the corner.

What a store's assistant should know

An assistant is only as good as what it reads. For a shop, the pages that matter most are the ones customers ask about before they buy:

  • Shipping: where you deliver, how long it takes and what it costs.
  • Returns and refunds: the time limit, who pays the postage and how to start one.
  • Sizes and fit: your size guide, and how your sizes compare to other brands if you know.
  • Your FAQ, and the pages about your products' materials, care or ingredients.

Add those pages as the assistant's knowledge and it answers from them, in your words. If a policy lives only in an email template or a PDF, upload it as a document. More on this in What to give your AI assistant so it answers well.

What it doesn't do

The assistant doesn't connect to WooCommerce's admin, so it can't look up an order, check stock or change a cart. That's on purpose: it never needs access to your customers' data. For "where's my order?" questions, add a form that collects the order number and email, and the chat sends it to you (see How to turn website chats into bookings and enquiries).

Caching and script optimisation

Stores lean on caching plugins more than most sites, and that's where most "the chat doesn't appear" problems come from:

  • Clear the cache in your caching plugin (and your host's dashboard, if it has one) after adding the code, then reload.
  • Delayed or combined JavaScript. Plugins that "delay", "combine" or "minify" scripts sometimes hold them back until the shopper scrolls or clicks. If the chat appears late or not at all, exclude pixe-widget.js in that plugin's settings.
  • Cart and checkout. Good caching plugins already skip WooCommerce's cart, checkout and account pages. That doesn't affect the chat, but if it shows there and not on product pages, you're looking at a cached copy of the product pages.

Will it clash with my theme?

It shouldn't. The chat draws itself in its own sealed-off area of the page, so your theme's styles can't change how it looks, and its styles can't leak into your store. Its colours, greeting and position come from the Widget tab in your Pixexl dashboard.

Some store themes and plugins put a floating button in a bottom corner, a "back to top" arrow, a mini cart or a WhatsApp button. If one sits where the chat button does, move the chat to the other corner in the Widget tab.

Cookie consent

The chat remembers a shopper's conversation in their browser, so it's covered by your cookie rules. Either keep the chat's own cookie notice (on by default, linked to your privacy policy from the Widget tab), or, if you already run a consent plugin, turn the chat's notice off, add data-consent="pending" to the script tag and have your consent tool call PixeWidget.grantConsent() when the shopper agrees. Pick one, not both.

It's not showing up: what to check

  • Caching, above. It's the usual one.
  • The domain. A staging site or a temporary address needs to be in the project's allowed domains.
  • The chat is switched off. Check that "Show the chat on my site" is on in the Widget tab.
  • A typo in the code. Copy the embed code again from the Settings tab rather than retyping it.
  • A security plugin or Content Security Policy that only allows approved scripts. Add the chat's script and API addresses (both are in the embed code) to its allowed list.

If it still won't appear, open your browser's developer console (right-click, Inspect, then Console). The chat leaves a short message there explaining why it didn't load.

After it's live

Ask it what your customers ask, and read the real conversations once a week: any question it fumbles points to something missing from your store's pages. Every Pixexl plan includes the assistant, and your first 2 weeks are free, so you can try it on your store with real shoppers before you decide. Meet Pixe AI to see what it can do.

WooCommerce chatbot questions

Do I need a WooCommerce chatbot plugin?

No. The chat is a single script tag, so a general header and footer code plugin, a Custom HTML block in your footer or your child theme's functions.php is all it takes. Nothing is added to your store's database.

Can the chatbot see my orders or stock?

No. The assistant answers from the pages and documents you give it, not from WooCommerce's admin, so it can't look up an order or check stock. For order questions, add a form so the chat collects the order number and email and sends them to you.

Does it show on the cart and checkout pages?

Yes. The code goes in your site's footer, which WooCommerce's cart, checkout and account pages use too, so the chat is there when a shopper hesitates.

Will it slow down my store?

Not noticeably. The script loads with async, so the browser fetches it without holding up the rest of your page, and it adds no database queries to WordPress.

Is there a free trial?

Yes. Every Pixexl plan includes the AI chat assistant, and your first 2 weeks are free, so you can try it on your store with real shoppers. See pricing for the plans.

More articles

· 7 min read

How to add a custom AI chatbot to your Shopify store

Shopify shoppers ask the same questions every day, about sizes, shipping and returns. Here's how to add an AI chat assistant that answers them from your own store's pages, with one line of code in your theme.

AI chatShopify

· 6 min read

How to add a custom AI chatbot to your Wix website

Wix lets you add a custom AI chat assistant to every page with its Custom Code setting, in about ten minutes. Here's how, which plan you need, and what to check if the chat doesn't appear.

AI chatWix

· 6 min read

How to add a custom AI chatbot to your Squarespace website

Squarespace's Code Injection setting adds an AI chat assistant to every page of your site in a few minutes. Here's how, which plans include it, and what to check if the chat doesn't appear.

AI chatSquarespace

Let your website answer for you.

We set up your assistant and site with you, usually within a day. Then your first 2 weeks are free, with real visitors.