Developer Reference
Constants
| Constant | Description |
|---|---|
SHOPCHAT_VERSION | Plugin version |
SHOPCHAT_PLUGIN_FILE | Absolute path to main plugin file |
SHOPCHAT_PLUGIN_DIR | Plugin directory path |
SHOPCHAT_PLUGIN_URL | Plugin URL |
Class Map
ShopChat uses PSR-4-style class mapping:
| Class | File |
|---|---|
ShopChat_Core | includes/class-shopchat-core.php |
ShopChat_REST_API | includes/class-shopchat-rest-api.php |
ShopChat_Widget | includes/class-shopchat-widget.php |
ShopChat_Knowledge_Base | includes/class-shopchat-knowledge-base.php |
ShopChat_Admin | includes/class-shopchat-admin.php |
ShopChat_Logger | includes/class-shopchat-logger.php |
Filters
| Filter | Arguments | Description |
|---|---|---|
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
| Action | Arguments | Description |
|---|---|---|
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
| Key | Default | Description |
|---|---|---|
enabled | true | Widget master toggle |
greeting | Hi! How can I help you today? | Opening message |
widget_position | right | Widget screen position |
ai_provider | '' | AI provider name |
brand_voice | '' | Brand personality instruction |
category_scope | [] | Scoped WC category IDs |
widget_color | #1a1a1a | Widget primary colour |
show_on_cart | false | Cart page widget |
show_on_checkout | false | Checkout page widget |
multilingual | false | Multilingual mode |
handoff_email | '' | Handoff transcript recipient |
handoff_url | '' | Handoff redirect URL |
handoff_label | Talk to a human | Handoff button text |