Documentation
ShopChat
Developer Reference

Developer Reference


Constants

ConstantDescription
SHOPCHAT_VERSIONPlugin version
SHOPCHAT_PLUGIN_FILEAbsolute path to main plugin file
SHOPCHAT_PLUGIN_DIRPlugin directory path
SHOPCHAT_PLUGIN_URLPlugin URL

Class Map

ShopChat uses PSR-4-style class mapping:

ClassFile
ShopChat_Coreincludes/class-shopchat-core.php
ShopChat_REST_APIincludes/class-shopchat-rest-api.php
ShopChat_Widgetincludes/class-shopchat-widget.php
ShopChat_Knowledge_Baseincludes/class-shopchat-knowledge-base.php
ShopChat_Adminincludes/class-shopchat-admin.php
ShopChat_Loggerincludes/class-shopchat-logger.php

Filters

FilterArgumentsDescription
shopchat_greeting$message (string)Override greeting message
shopchat_products_query_args$args (array), $query (string)Modify WC product query for catalog search
shopchat_ai_context$context (array), $message (string)Modify AI context before sending
shopchat_ai_response$response (string), $message (string)Modify AI response before returning to widget
shopchat_roi_order_ids$order_ids (array)Modify list of ShopChat-influenced order IDs
shopchat_widget_css_vars$vars (array)Override widget CSS custom properties
shopchat_rest_auth$allowed (bool), $request (WP_REST_Request)Custom REST endpoint authentication

Actions

ActionArgumentsDescription
shopchat_conversation_started$session_id (string)Fires when a new conversation begins
shopchat_message_sent$message (string), $session_id (string)Fires on each customer message
shopchat_handoff_triggered$session_id (string), $transcript (string)Fires when handoff is triggered
shopchat_kb_synced$count (int)Fires after knowledge base sync; count = articles indexed
shopchat_order_influenced$order_id (int), $session_id (string)Fires when an order is attributed to ShopChat

Default Settings

KeyDefaultDescription
enabledtrueWidget master toggle
greetingHi! How can I help you today?Opening message
widget_positionrightWidget screen position
ai_provider''AI provider name
brand_voice''Brand personality instruction
category_scope[]Scoped WC category IDs
widget_color#1a1a1aWidget primary colour
show_on_cartfalseCart page widget
show_on_checkoutfalseCheckout page widget
multilingualfalseMultilingual mode
handoff_email''Handoff transcript recipient
handoff_url''Handoff redirect URL
handoff_labelTalk to a humanHandoff button text