ShopChat Developer Reference
Constants
| Constant | Description |
|---|---|
SHOPCHAT_VERSION | Plugin version |
SHOPCHAT_FILE | Absolute path to the main plugin file |
SHOPCHAT_PATH | Plugin directory path |
SHOPCHAT_URL | Plugin URL |
SHOPCHAT_BASENAME | windcodex-shopchat/windcodex-shopchat.php |
SHOPCHAT_LICENSE_OPTION | Option name for the license key (shopchat_license_key) |
SHOPCHAT_LICENSE_STATUS_OPTION | Option name for the license status (shopchat_license_status) |
Filters
| Filter | Arguments | Description |
|---|---|---|
shopchat_returnable_statuses | $statuses (array) | Order statuses that can be returned. Default ['completed', 'delivered'] |
shopchat_widget_product_id | $product_id (int) | The product the widget treats as "current" on a page |
Example - also allow returns for Processing orders:
add_filter( 'shopchat_returnable_statuses', function ( array $statuses ) {
$statuses[] = 'processing';
return $statuses;
} );There are no ShopChat actions.
REST API
Namespace shopchat/v1 - see REST API.
Scheduled Event
| Hook | Schedule | Description |
|---|---|---|
| Knowledge base sync | Daily | Re-crawls pages, posts and product categories |
Stored Data
| Name | Type | Contents |
|---|---|---|
{prefix}shopchat_logs | Table | Chat log (messages, errors, handoffs, returns) |
shopchat_settings | Option | All settings |
shopchat_roi_YYYY_MM | Options | Monthly ROI counters |
_shopchat_return_requested | Order meta | Timestamp of the return request submitted in the chat (one per order) |
shopchat_license_key, shopchat_license_status | Options | License |
Default Settings
Stored in shopchat_settings:
| Key | Default | Description |
|---|---|---|
enabled | true | Show the widget |
greeting | Hi! Ask me anything about this product. | First message |
widget_position | right | right or left |
ai_provider | '' | Selected connector |
brand_voice | '' | Brand voice instruction |
category_scope | [] | Category IDs to limit the assistant to |
widget_color | #1a1a1a | Primary colour |
widget_icon | '' | Custom launcher icon URL |
show_on_cart / show_on_checkout | false | Page visibility |
multilingual | false | Multilingual replies |
handoff_email / handoff_url / handoff_label | '' | Live Agent Handoff |
nudge_exit_intent | false | Exit-intent nudge |
nudge_idle_seconds | 0 | Idle nudge |
enable_voice / enable_image | false | Multimodal inputs |
enable_upsells / enable_search / enable_returns / enable_multi_agent | true | Features |
return_window_days | 30 | Return window |
enable_kb | true | Use the knowledge base |