Skip to main content
Each Tolstoy widget has its own code. To change what a widget does, you do not call a JavaScript API from your theme. You tell the widget agent what you want, and the agent changes the widget’s code. The agent can connect the widget to the code of your store: your cart drawer, your quick view, your buttons, and your analytics.

Change a widget

1

Open the widget

In Tolstoy, go to Widgets and open the widget.
2

Tell the agent what you want

Write your request in the chat.
3

Examine the preview

The agent shows the result in Widget Preview. The Code tab shows the code. Ask for more changes until the widget does what you want.
4

Publish

Click Publish. Your store does not change until you publish.

Write a good request

  • Write what the shopper does and what must happen. For example: “When a shopper clicks Add to cart, open my cart drawer.”
  • Give the URL of a page where the widget shows. The agent can open your store in a browser and examine its code.
  • If you know the function, element, or event that your theme uses, give its name. Then the agent does not have to find it.
  • If mobile and desktop must be different, write what each one must do.

Examples

Replace the names in these examples with the names that your store uses.

Use your cart drawer

Open your quick view

Open the player from your button

Close the player when your cart opens

Send events to your analytics

Show the widget only on some pages

Match your store design

Two features have a page API that your site code can call: Cookie Consent and the Chat Assistant.