The “Buy”, “Add to wishlist” and “Compare” buttons on Elbuz chat product cards call your JavaScript, so the product lands in your site's cart mid-conversation. Common CMSs get ready-made code from a list.
When you need this:
- “Buy” opens the product page — event code adds the product to the cart at once.
- OpenCart, WooCommerce, Shopify or Horoshop — a “CMS ID” fills in ready-made code.
- The chat covers another widget's button — custom code hides it on open and restores it on close.
- Chat window details clash with the site — custom CSS fixes them.
Where to start: “Setup” tab → “Site” card → “CMS ID”.
What you can configure
- Ready-made code for a CMS — the six event fields are filled in by choosing a platform.
- Event code — what each field does and what happens if it's empty.
- Product data — what your code receives.
- A site with smart search — whose code runs.
- Custom JS and CSS — code on window open and close, styles.
Ready-made code for your CMS
On the “Setup” tab, in the “Site” card, choose your platform in “CMS ID”. The app fills in code for that CMS in the six fields of the “Events” tab, and if “Site address” is filled in, also the “Cart link” on the “Links” tab.
| CMS | Cart | Wishlist and comparison |
|---|---|---|
| OpenCart | add and remove | yes |
| Elbuz CMS | add and remove | yes |
| WooCommerce (WordPress) | add and remove | yes, for common wishlist and comparison plugins |
| Magento (Adobe Commerce) | add and remove | yes |
| Horoshop | add and remove | yes |
| Shopify | add and remove | no |
| PrestaShop, BigCommerce, Squarespace Commerce | no ready-made code — your developer writes it | no |
“CMS theme” lists OpenCart themes: OCT ShowCase, OCT Deals, OCT Promo; only themes of the chosen CMS appear. A theme adds to the OpenCart code updates of the cart, wishlist and comparison counters in the site header and opening of the mini cart, and ShowCase and Deals also add code to “Run JS code after closing”.
The app fills in empty fields silently. If the ready-made code would replace fields you've already filled in, the question “Apply CMS settings?” appears with a list of those fields:
- “Replace” — put the ready-made code into filled-in fields too;
- “Fill empty only” — your code stays, the ready-made code goes only into empty fields;
- “Cancel” — change nothing.
The “---” option changes nothing.
The new values appear in the fields but are saved when you close the window or change another field. In a store on Elbuz CMS, the event code is filled in when the widget is connected, so there's nothing to choose. If you chose OpenCart before 15.11.2026, choose the CMS again and click “Replace” — then “Remove from cart” will also work from the chat.
1
Site address2
CMS ID3
CMS theme- The base of links; with it, choosing a CMS also fills in the cart addresses.
- Inserts ready-made event code for your platform.
- OpenCart themes; the list has only the themes of the chosen CMS.
Event code: what each field does
The “Events” tab has six fields — a pair each for the cart, the wishlist and comparison. The code runs in the shopper's browser, on your site, when they click a button on a product card in the chat.
| Field | When it runs | If the field is empty |
|---|---|---|
| “Add to cart” | a click on “Buy” on a product card | the click opens the product page in a new tab |
| “Remove from cart” | a second click on a button that's already added | the second click does nothing |
| “Add to wishlist”, “Add to comparison” | a click on “Add to wishlist” or “Compare” | the button only changes its look; nothing is sent to the site |
| “Remove from wishlist”, “Remove from comparison” | a second click on these buttons | the button only changes its look |
A button turns “added” only if the code worked: if the code sends a request to the site, the response must be successful and carry no error flag. Otherwise the shopper sees “Could not add: you may need to choose product options.” and a link to the product. After a successful add, “Go to cart” appears below the product list if a cart link is set.
1
Add to cart2
Remove from cart3
Wishlist and comparison- Runs on “Buy”; if empty, the product page opens.
- A second click on the added button.
- If the fields are empty, the button only changes its look.
What product data the code gets
The code receives the productData variable with these fields:
| Field | What it holds |
|---|---|
id | the product number in Elbuz |
id_ext | the product number in your CMS — what the site's cart expects |
sku, mpn | SKU and manufacturer part number |
name, url, image_url | name, product link and photo |
productData has no quantity or price: the ready-made templates add one item. The CMS number (id_ext) comes from the product card, or, if an external source is set on the “Links” tab, from the link to it (source). A product without a CMS number won't get into the site's cart.
If the catalog has no CMS number or it's different, fill in the “Product ID extraction” card on the “Events” tab: before the cart code runs, the widget opens the product page and takes the number with a CSS selector or a regular expression (“Extraction type”). Without the “Always extract ID from product page, even if id_ext is filled” checkbox, the number is taken from the page only when the catalog has none; with it — always. It works the same as in smart search.
A site that also has smart search
If the smart search widget runs on the page, “Buy”, “Add to wishlist” and “Compare” in the chat run the code from the search settings, not the chat's (cart in smart search). Removing a product from the cart works differently: first the chat's “Remove from cart” runs, and after it succeeds, the search's removal code. So on a site with search, set up the cart in search and “Remove from cart” in the chat.
Custom JS and CSS for the widget
The “JS, CSS settings” card on the “Setup” tab is for a developer fitting the chat to the site.
- “Run JS code before opening” — runs every time before the chat window appears. A typical use is hiding another widget's button that covers the chat.
- “Run JS code after closing” — after the shopper closes the window: bring back what was hidden.
- “CSS Styles” — added to the page when the chat loads.
- “JS code” — runs once, when the chat has loaded on the page.
The chat adds its own code to the open and close code: it hides and restores the Binotel widget if the site has one.
1
Code on opening2
Code after closing3
CSS styles- Runs every time before the chat window appears.
- Brings back what was hidden on opening.
- Added to the page together with the chat.
Scenarios
A site on OpenCart
What to set up. “Site address”, “CMS ID” — OpenCart, and “CMS theme” if needed.
What you get. “Buy” in the chat adds one item to the site's cart, a second click removes it, and “Go to cart” appears below the products.
A site on a platform without ready-made code
What to set up. A developer writes a call to the site's cart with productData.id_ext in “Add to cart”.
What you get. The same as with ready-made code. While the field is empty, “Buy” opens the product page.
The chat covers the callback button
What to set up. In “Run JS code before opening” — hide the button; in “Run JS code after closing” — show it.
What to do when the chat buttons don't work
| What you see | Why | What to do |
|---|---|---|
| “Buy” opens the product page | “Add to cart” is empty | Choose a “CMS ID” or enter code (CMS) |
| “Could not add: you may need to choose product options.” | The site responded with an error — often the product has no CMS number | Check the product's CMS number in the product card or set up “Product ID extraction” (data) |
| The old event code stayed after choosing a CMS | “Fill empty only” or “Cancel” was clicked in the “Apply CMS settings?” question | Choose the CMS again and click “Replace” (CMS) |
| You changed the chat's event code, but nothing changed on the site | The site has smart search, and its code runs | Edit the code in the search widget (search) |
| Your open or close code doesn't run | A syntax error in the code | Check the code in the browser console (JS) |
FAQ
Does the chat work without event code?
Yes. The chat answers and shows products, and “Buy” opens the product page, where the shopper adds it to the cart themselves.
Can I add two items from the chat?
The ready-made templates add one item: the product data has no quantity (data). More can be added in the site's cart.
Why use the site's cart if the AI takes orders in the chat?
These are two different paths. Checkout in the conversation creates an order in Elbuz, while the site's cart is for shoppers who check out on their own (orders from the chat).
Do I need chat event code if the site has smart search?
For “Buy”, the wishlist and comparison — no, the search code runs. Fill in “Remove from cart” in the chat, otherwise products can't be removed from the chat (search).
Where to find it and who has access
- Menu
- Directories → Categories → “Catalog tools” → “Widget settings - Smart Assistant” → “Events” tab
- CMS, JS and CSS
- the same form, “Setup” tab → “Site” and “JS, CSS settings” cards
- Prepare
- CMS numbers in product cards; for your own platform — a developer
Related topics
- If you need the big picture of chat settings — how to set up the chat widget on your website.
- If “Go to cart” leads to the wrong place — cart link.
- If the site also has smart search — cart in smart search.
- If the shopper should place an order right in the conversation — leads and orders from the chat.
