Docs AI Shopping Assistant Developers: Hooks & Filters

Developers: Hooks & Filters

Everything on this page is public API and kept backward compatible between releases. Anything not listed here is internal and may change without notice.

Put these in your theme’s functions.php or a small site plugin. None of them is needed for normal use — the assistant works without a line of code.

Is the Plugin Running?

if ( function_exists( 'ai_shopping_assistant_is_running' ) && ai_shopping_assistant_is_running() ) {
    // The assistants, their tools and their routes are available.
}

This answers the practical question — is there an assistant to integrate with on this request? It is false when the plugin’s requirements are not met, and false without an active license, because a plugin without one registers nothing beyond its own License screen: no tools, no chat on the shop and no REST routes but the license’s own.

Do not test for the plugin by counting ai_shopping_assistant_loaded yourself. That action fires whether or not the license is active, so it would tell you the plugin is there while none of it is available. Use ai_shopping_assistant_is_running().

Actions

ActionWhen it firesArguments
ai_shopping_assistant_loadedAfter the plugin registers its hooks — including when the license is inactive and all it registered was the License screenThe plugin instance
ai_shopping_assistant_outcomeA conversation started, a cart was created, or a shopper was sent to checkoutstring $event, float $value
ai_shopping_assistant_eventEvery event the plugin records — tool calls, refusals and knowledge denialsThe audit event
ai_shopping_assistant_search_missedA product search found nothingThe search text

Every action and filter below the first one fires only while the plugin is running. Without an active license none of them is ever reached, so a listener on them needs no license check of its own.

Search and Language

FilterDefaultWhat it changes
ai_shopping_assistant_search_wordsThe shopper’s words, filler removed and plurals stemmedThe words a product search tries one at a time. Add your shop’s synonyms here.
ai_shopping_assistant_retrieval_lexiconWord lists for seven languagesThe words the no-AI answerer recognises. Add a language, or more words for one. A term ending in * matches any ending.
// Treat "jumper" as another word for "hoodie".
add_filter( 'ai_shopping_assistant_search_words', function ( $words ) {
    if ( in_array( 'jumper', $words, true ) ) {
        $words[] = 'hoodie';
    }
    return $words;
} );

Orders and Tracking

FilterDefaultWhat it changes
ai_shopping_assistant_order_trackingFrom Advanced Shipment Tracking, WooCommerce Shipment Tracking and TrackShipThe shipments shown to a customer for their own order. Only provider, number, shipped, link and status survive.
ai_shopping_assistant_order_id_from_numberThe number, when numericMaps a customer-facing order number to an order id. Use this with a sequential order number plugin.
ai_shopping_assistant_login_urlThe WooCommerce My account pageWhere the Log in button sends a guest who asked about an order.

Returns

FilterDefaultWhat it changes
ai_shopping_assistant_returns_availableWhether Returns for WooCommerce is active and licensedWhether the chat offers its returns form. Return false to turn it off.

Where the Chat Appears

FilterDefaultWhat it changes
ai_shopping_assistant_shop_widget_enabledtrueWhether the chat button appears on this request. Use it for a landing page the settings cannot describe.
ai_shopping_assistant_shop_disclosurePer modeThe wording of the line under the message box. It cannot be switched off.
ai_shopping_assistant_shop_brandingOnThe “powered by” line.

Cost and Rate Limits

FilterDefaultWhat it changes
ai_shopping_assistant_daily_tokens500,000The daily token budget. The second argument is the assistant.
ai_shopping_assistant_message_cap20Messages allowed in one conversation.
ai_shopping_assistant_shop_max_rounds4Tool rounds for one shopper message.
ai_shopping_assistant_shop_max_tokens15,000Tokens of tool results for one shopper message.
ai_shopping_assistant_shop_retrieval_budget3,000Tokens of quoted material per turn. Over it, material is trimmed and the trim is declared.
ai_shopping_assistant_shop_visitor_per_minute20Messages one address may send per minute.

Privacy and Logging

FilterDefaultWhat it changes
ai_shopping_assistant_visitor_ipREMOTE_ADDRThe address guest limits key on.
ai_shopping_assistant_event_retention_days30How long the activity log is kept. The daily clear-out pauses while the license is inactive, so nothing is removed during that time.
ai_shopping_assistant_public_email_addressesThe site’s admin emailAddresses the chat may repeat to shoppers. Others are masked.
Behind a reverse proxy or CDN, ai_shopping_assistant_visitor_ip should return the client address your proxy sets — never a forwarded header the proxy does not overwrite, which a visitor could set themselves to slip past the limits.

Store Assistant

FilterDefaultWhat it changes
ai_shopping_assistant_chat_system_promptThe built promptThe store assistant’s instructions.
ai_shopping_assistant_chat_max_rounds / _max_tokens6 / 60,000Its per-question caps.
ai_shopping_assistant_seo_description_keysYoast SEO, Rank Math and SEOPress keysThe product meta checked by “products missing an SEO description”.

Detecting the Plugin From Another Plugin

\ZoremAgentBridge\V1\Bridge::features()->has( 'agent-os.experiences' );

This feature is announced only while the plugin is running, so like ai_shopping_assistant_is_running() it is false on a site whose license is inactive. Either check is a safe way to decide whether to integrate.

There is deliberately no filter on an assistant’s tool list. Each assistant’s tools are fixed in the code, so no plugin and no setting can widen what it is able to do.