---
title: How to install the agent on WordPress and WooCommerce
description: Three ways to embed code on WordPress, how the agent reads the WooCommerce catalog, what to do with caching plugins, and how to link the chat to the cart.
section: platforms
keywords: WordPress, WooCommerce, install AI agent WordPress, embed code WordPress, WordPress chat widget, AI sales agent WooCommerce, footer.php WordPress, code snippet plugin WordPress, connect chat to cart WooCommerce, caching plugins WordPress, AI chatbot for e-commerce, website chat integration
updated: 2026-09-06
---
On WordPress, the code can be inserted in three ways. Choose based on your comfort level with editing theme files.

## Method 1: Code Insertion Plugin (Recommended)

This is the safest option: your changes will not be lost when the theme updates.

1.  Install any script insertion plugin: WPCode, Insert Headers and Footers, Code Snippets.
2.  Open the plugin settings and find the field for footer code — it's usually called **Footer** or **Body (before closing tag)**.
3.  Paste the line from your account and save.

## Method 2: Theme File

1.  **Appearance → Theme File Editor**.
2.  Open `footer.php`.
3.  Paste the code before `</body>`.
4.  Update the file.

Important: Edit a child theme. When the parent theme updates, the file will be overwritten along with your code.

## Method 3: Via functions.php

For those more comfortable with code. In your child theme's `functions.php`:

```php
add_action('wp_footer', function () {
    echo '<script src="https://comag.vibevox.pro/widget.js" data-slug="your-slug" async></script>';
});
```

Get the exact script line from your account, using the "Copy code" button.

## WooCommerce Catalog

Enter your website address in the settings and start the analysis. The crawler reads WooCommerce products via structured page data: name, price, availability, description, photos, categories.

What to know:

-   **Variable products** appear in the product card with a price range and characteristics.
-   **Hidden and draft products** are not read — this is by design.
-   The agent will not see **products for authorized users only**: it browses the site as a regular visitor.
-   If you have a product export in CSV, you can upload it in the "Catalog" section — sometimes this is faster and more accurate than crawling.

## Cart and Checkout

On WooCommerce, payment in chat is usually not enabled: the store has its own checkout with shipping, taxes, and coupons.

Specify the cart link in the settings, most often `https://your-domain/cart` or `/cart`. The agent will guide the buyer there.

To see which conversations turn into orders, add a purchase pixel snippet to the "Thank you for your order" page. In WooCommerce, this is the `checkout/thankyou.php` template or the same code insertion plugin with a condition for the order page.

## Chat Button Adds Product to WooCommerce Cart

Product cards in agent responses are not just decorative images. Each has a link to the product page in your store, and the agent can use WooCommerce's standard mechanism for adding to cart: an address like `?add-to-cart=123`.

The buyer clicks the button in the chat, the product goes into the cart, and your checkout then handles all shipping, coupon, and tax plugins. No integrations or keys are needed for this: the mechanism is built into WooCommerce from the start.

If the link leads to a variable product page, the agent opens it — the buyer must choose the size and color themselves, and this is correct: substituting an option for them is risky.

Another thing to know: the agent sees the page where the chat is open. It reads the product markup — name, SKU, price — and responds in context. If a visitor is on a product page and asks "is there anything cheaper?", the agent understands what to compare it with and offers an alternative from your catalog, not an abstract suggestion.

The main reason the "widget did not appear" on WordPress is caching. After inserting the code:

1.  Clear your plugin cache: WP Rocket, W3 Total Cache, LiteSpeed, or whatever you use.
2.  Clear your CDN cache, if you use Cloudflare.
3.  Check the site in incognito mode.

If "combine and defer scripts" is enabled in the plugin, add our script to the exclusions: merging third-party scripts sometimes breaks loading.

## Light and Dark Theme

The widget supports both. In the settings, you can choose a light theme, a dark theme, or "as per visitor's settings" — the latter follows the device's system settings and is the default.

This is convenient if your WordPress theme has a day/night switch: leave it as "as per visitor's settings", and the chat will match what the person has already chosen on their device.

## Caching Plugins

## Verification

-   The chat button appears in the bottom right corner on any page of the site.
-   A product question yields a product card with a price.
-   The checkout button leads to the WooCommerce cart.
-   On mobile, the button does not overlap the menu and cart.

## Frequently Asked Questions

### Is a separate Commerce Agents plugin needed?

No. A single line of code is sufficient; a separate plugin is not required or installed.

### The widget did not appear, what to check first?

Cache: caching plugin and CDN. Then — ensure the code is inserted into the footer, not a random sidebar widget, and that the theme actually outputs `wp_footer()`.

### Will the agent know about discounts and coupons?

No, not about coupons: they are applied in the WooCommerce cart. The agent displays prices as they were during the crawl, including discounted prices if shown on the product page.

### Will this slow down the site?

The script is asynchronous, lightweight, and does not block page rendering. The impact on PageSpeed is minimal.

### Can the widget be shown only in the shop, not in the blog?

Yes, if you insert the code via a plugin with display conditions or in `functions.php` with an `is_woocommerce()` check. In the simplest case, the agent on all pages is not intrusive: it also answers questions about shipping from the blog.
