Hooks
Geeky Bot and Commerce Pro expose WordPress filters and actions so you can adjust search, answers and visibility without editing plugin files. This page lists the hooks in Geeky Bot 2.1.3 and Commerce Pro 2.1.2, with examples for the most useful ones.
Put your code in a small custom plugin or your child theme’s functions.php. Arguments are listed in the order your callback receives them; pass the right argument count to add_filter() or add_action() when you need more than the first one.
Answers and AI
Section titled “Answers and AI”| Hook | Type | Arguments | What it’s for |
|---|---|---|---|
geekybot_ai_system_prompt_lines |
Filter | $lines (array): system prompt lines |
Adds extra rules to the instructions sent to OpenAI or Zywrap. Append restrictions or presentation rules only; don’t remove the rules that keep answers grounded in your catalog and policy pages. Lines are stripped of HTML. |
geekybot_ai_grounded_user_prompt |
Filter | $prompt (string), $message (string): shopper message, $products (array): product context, $knowledge_matches (array): policy page context |
Appends safe, non-secret instructions to the prompt sent to OpenAI. |
geekybot_ai_context_array |
Filter | $context (array), $products (array), $knowledge_matches (array) |
Adds safe structured context to the request sent to Zywrap. $context holds products, policy_pages and rules. |
geekybot_product_expert_facts |
Filter | $facts (array): normalized product facts, $product (WC_Product) |
Adds trusted, store-owned facts that Geeky Bot uses to answer questions about one product, such as “What is it made of?”. Never pass shopper-supplied values. |
geekybot_assistant_capabilities |
Filter | $capabilities (array of strings) |
The list Geeky Bot reads out when a shopper asks “What can you do?”. Add an entry when your extension adds a capability. |
geekybot_unsupported_intent |
Filter | $result (array with type and message), $message (string): raw shopper message |
The detected request that Geeky Bot can’t handle, with its reply. If your extension handles that kind of request, return an empty type so the message continues as normal. |
geekybot_cart_actions_available |
Filter | $available (bool): true when Commerce Pro is active |
Whether cart actions from the chat are available. Return true if another add-on handles cart actions. |
geekybot_chat_response_payload |
Filter | $payload (array), $message (string): answer shown to the shopper, $products (array), $intent (string) |
Appends safe public metadata to the chat response. Don’t remove core fields or expose secrets or internal settings. |
Commerce extension points
Section titled “Commerce extension points”Commerce Pro uses these to take part in the conversation. Another commerce add-on can use them the same way.
| Hook | Type | Arguments | What it’s for |
|---|---|---|---|
geekybot_chat_pre_discovery_reply |
Filter | $reply (null), $message (string), $context_resolution (array), $session_id: conversation ID |
Answers a message before product search runs. Return null to leave it to Geeky Bot, or an array with message and optionally productIds and intent. Commerce Pro answers comparisons and order questions here. |
geekybot_shopping_command_result |
Filter | $result (array), $action (string), $context_resolution (array), $products (array), $session_id: conversation ID, $session_key (string) |
Handles a cart, checkout or comparison command. Return an array with handled, message, and optionally productIds, intent and extra. When Commerce Pro is installed it answers first, and this filter runs only if it didn’t handle the command. |
geekybot_keeps_product_subject |
Filter | $keeps (bool), $message (string), $previous (array): previous conversation context |
Whether a follow-up message keeps the products already on screen as its subject, so words like “bigger” or “lighter” aren’t treated as a new search. |
Example: add a rule for AI answers
Section titled “Example: add a rule for AI answers”add_filter('geekybot_ai_system_prompt_lines', function ($lines) { $lines[] = 'Never promise a delivery date.'; return $lines;});Search
Section titled “Search”| Hook | Type | Arguments | What it’s for |
|---|---|---|---|
geekybot_search_synonyms |
Filter | $synonyms (array): 'shopper word' => array('catalog word', ...) |
Multilingual search synonyms, including the custom synonyms saved on Product Search. |
geekybot_search_query_terms |
Filter | $terms (array), $normalized (string): normalized query, $language (string): language code |
The final search terms after normalization and stop-word removal. |
geekybot_search_stop_words |
Filter | $words (array), $language (string) |
Words ignored in searches, per language. |
geekybot_search_commerce_phrases |
Filter | $phrases (array), $query (string) |
Shopping phrases removed before product matching, such as “looking for” or “do you have”. |
geekybot_search_facets |
Filter | $facets (array with colors and sizes), $query (string), $terms (array) |
Colours and sizes read from the shopper’s question. |
geekybot_search_negative_facets |
Filter | $facets (array with colors and sizes), $query (string) |
Colours and sizes the shopper wants to exclude, as in “not black”. |
geekybot_search_color_keywords |
Filter | $map (array): canonical colour => aliases |
Words recognised as each colour, in all supported languages. |
geekybot_search_size_keywords |
Filter | $map (array): canonical size => aliases |
Words recognised as each size. |
geekybot_search_buyer_preference_keywords |
Filter | $map (array): preference => aliases |
Preference words such as comfortable, formal, budget or gift. |
geekybot_search_buyer_use_case_keywords |
Filter | $map (array): use case => aliases |
Use-case words such as winter, sports, travel or party. |
geekybot_search_buyer_modifier_terms |
Filter | $terms (array), $query (string) |
Soft preference terms that boost matching products but aren’t required. |
geekybot_search_buyer_modifier_labels |
Filter | $labels (array), $query (string) |
Labels for the preferences Geeky Bot found in the question. |
geekybot_search_strip_buyer_modifier_phrases |
Filter | $phrases (array), $query (string) |
Preference phrases removed from the query before product matching. |
geekybot_buyer_intent_profile |
Filter | $profile (array), $query (string) |
The buyer-intent profile Geeky Bot builds from a question: preferences, recipient, gift signals and ranking weights. |
geekybot_buyer_intent_language |
Filter | $language (string): two-letter code |
Which buyer-intent language pack to use. English is the fallback. |
geekybot_search_latin_language |
Filter | $best (string): two-letter code, or '' when undecided, $query (string), $scores (array) |
The language guessed from a question written in Latin script. |
geekybot_cms_language_code |
Filter | $code (string): two-letter code, or '' |
The shopper’s language from a multilingual plugin. Geeky Bot reads WPML and Polylang; use this to supply the language from another plugin. |
geekybot_product_family_aliases |
Filter | $aliases (array), $family (string) |
Other words for a product family, used when indexing. |
geekybot_product_relation_families |
Filter | $families (array): family => words |
Product families used to find similar products. |
geekybot_product_relation_groups |
Filter | $groups (array): group => families |
Broader groups of families used when ranking similar products. |
geekybot_related_product_families |
Filter | $relations (array): family => (related family => strength) |
Which families count as valid alternatives to each other, and how strongly. |
geekybot_fulltext_supported |
Filter | $supported (bool): false on SQLite |
Whether product search may use the database’s FULLTEXT index. Return false on a database without full-text search. See Playground and SQLite. |
Example: add synonyms in code
Section titled “Example: add synonyms in code”add_filter('geekybot_search_synonyms', function ($synonyms) { $synonyms['jumper'] = array('sweater', 'pullover'); return $synonyms;});You can also add synonyms on Geeky Bot → Product Search without code. See Catalog quality and synonyms.
Which products shoppers see
Section titled “Which products shoppers see”| Hook | Type | Arguments | What it’s for |
|---|---|---|---|
geekybot_product_visible_to_shopper |
Filter | $visible (bool), $product (WC_Product), $purpose (string): internal purpose label |
The final decision on whether the assistant may show a product. Use it to hide more products. Don’t use it to show products that WooCommerce hides. |
geekybot_product_payload |
Filter | $product_data (array), $product (WC_Product) |
The product data used for product cards in the widget. Add non-secret display data only. |
Example: keep a category out of the chat
Section titled “Example: keep a category out of the chat”add_filter('geekybot_product_visible_to_shopper', function ($visible, $product, $purpose) { if ($visible && has_term('wholesale', 'product_cat', $product->get_id())) { return false; } return $visible;}, 10, 3);Smart Catalog
Section titled “Smart Catalog”| Hook | Type | Arguments | What it’s for |
|---|---|---|---|
geekybot_smart_catalog_connection |
Filter | $connection (array with provider and label, or null) |
Supplies a custom AI connection for Smart Catalog. Pair it with geekybot_smart_catalog_pre_request to answer the calls. |
geekybot_smart_catalog_pre_request |
Filter | $pre (null), $items (array): products sent to the model, $provider (string): openai or zywrap |
Skips the provider call, for tests or a custom provider. Return an array of product ID => word groups, or a WP_Error. Return null to make the normal request. |
See Smart Catalog.
Rescue and learning
Section titled “Rescue and learning”| Hook | Type | Arguments | What it’s for |
|---|
See Rescue and learning.
Storefront
Section titled “Storefront”| Hook | Type | Arguments | What it’s for |
|---|---|---|---|
geekybot_store_hidden_from_visitor |
Filter | $hidden (bool): true |
Runs only while WooCommerce Coming soon mode hides the store from the current visitor. Return false to show the chat to that visitor anyway. Administrators, shop managers and visitors with the private preview link already see it. |
geekybot_public_chat_payload |
Filter | $public (array): sanitized storefront response, $payload (array): full internal response |
Adjusts display-only fields of the response sent to the browser. Geeky Bot rebuilds the response from its list of allowed fields after this filter, so other fields are dropped. |
Admin and Guided Demo
Section titled “Admin and Guided Demo”| Hook | Type | Arguments | What it’s for |
|---|---|---|---|
geekybot_guided_demo_examples |
Filter | $examples (array), $rows (array): catalog rows |
The example questions on Geeky Bot → Guided Demo. |
geekybot_guided_demo_pro_state |
Filter | $state (array with active, add_to_cart, variation_selection, cart_commands) |
Which Commerce Pro examples are unlocked. Commerce Pro fills it in. |
geekybot_guided_demo_variation_selection |
Filter | $selection (array), $product_id (int) |
The variation options used in the variation example. |
Plugin lifecycle and errors
Section titled “Plugin lifecycle and errors”| Hook | Type | Arguments | What it’s for |
|---|---|---|---|
geekybot_core_loaded |
Action | none | Fires after Geeky Bot’s services and public hooks are loaded. Add-ons attach their integration here. |
geekybot_database_migrated |
Action | $version (string) |
A Geeky Bot database migration succeeded. |
geekybot_database_migration_failed |
Action | $version (string) |
A migration couldn’t confirm its final schema. |
geekybot_database_repaired |
Action | $missing (array): tables that had been absent |
Missing tables were recreated. |
geekybot_database_repair_failed |
Action | $missing (array): tables still absent |
Missing tables couldn’t be recreated. |
geekybot_internal_chat_error |
Action | $error (Throwable) |
A storefront chat request failed. The shopper gets a generic message; use this for server-side logging. |
geekybot_internal_catalog_error |
Action | $error (Throwable) |
A request to Geeky Bot’s product search REST route (geekybot/v1/products) failed. The caller gets a generic message. |
Example: log chat errors
Section titled “Example: log chat errors”add_action('geekybot_internal_chat_error', function ($error) { error_log('Geeky Bot chat error: ' . $error->getMessage());});Privacy
Section titled “Privacy”| Hook | Type | Arguments | What it’s for |
|---|---|---|---|
geekybot_order_lookup_enabled |
Filter | $enabled (bool), $user_id (int) |
Commerce Pro. Whether order help may read the signed-in shopper’s orders. Return false to switch it off. |
gbcp_analytics_storage_allowed |
Filter | $allowed (bool) |
Commerce Pro. Whether an analytics event may be stored for this request. For guests it follows the Geeky Bot settings Save conversation history and Save guest conversations. |
See Privacy and data.
Licence
Section titled “Licence”| Hook | Type | Arguments | What it’s for |
|---|---|---|---|
geekybot_commerce_pro_license_verified |
Action | $license (array): saved licence state |
The licence was checked and Commerce Pro may run on this site. |
geekybot_commerce_pro_license_deactivated |
Action | $license (array): saved licence state |
The licence was deactivated, refused, or no longer covers this site. |
Zywrap
Section titled “Zywrap”| Hook | Type | Arguments | What it’s for |
|---|---|---|---|
geekybot_zywrap_enabled |
Filter | $visible (bool): true |
Return false to hide Zywrap on AI & Privacy and stop Smart Catalog from using it. Chat answers still go to Zywrap while it is the saved answer mode. |
See Zywrap.
Translations
Section titled “Translations”| Hook | Type | Arguments | What it’s for |
|---|---|---|---|
geekybot_translations_auto |
Filter | $on (bool): false when GEEKYBOT_TRANSLATIONS_AUTO is false |
Whether Geeky Bot installs and updates its translation by itself. Geeky Bot → Languages works either way. |
geekybot_translations_source |
Filter | $url (string): address of the translation list |
Where the list of translations is read from. Used for testing against another server. |
Commerce Pro database
Section titled “Commerce Pro database”| Hook | Type | Arguments | What it’s for |
|---|---|---|---|
gbcp_database_migrated |
Action | $version (string) |
A Commerce Pro database migration succeeded. |
gbcp_database_migration_failed |
Action | $version (string) |
A Commerce Pro migration couldn’t confirm its final schema. |