Documentation
ShopChat
Developer Reference

ShopChat Developer Reference


Constants

ConstantDescription
SHOPCHAT_VERSIONPlugin version
SHOPCHAT_FILEAbsolute path to the main plugin file
SHOPCHAT_PATHPlugin directory path
SHOPCHAT_URLPlugin URL
SHOPCHAT_BASENAMEwindcodex-shopchat/windcodex-shopchat.php
SHOPCHAT_LICENSE_OPTIONOption name for the license key (shopchat_license_key)
SHOPCHAT_LICENSE_STATUS_OPTIONOption name for the license status (shopchat_license_status)

Filters

FilterArgumentsDescription
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

HookScheduleDescription
Knowledge base syncDailyRe-crawls pages, posts and product categories

Stored Data

NameTypeContents
{prefix}shopchat_logsTableChat log (messages, errors, handoffs, returns)
shopchat_settingsOptionAll settings
shopchat_roi_YYYY_MMOptionsMonthly ROI counters
_shopchat_return_requestedOrder metaTimestamp of the return request submitted in the chat (one per order)
shopchat_license_key, shopchat_license_statusOptionsLicense

Default Settings

Stored in shopchat_settings:

KeyDefaultDescription
enabledtrueShow the widget
greetingHi! Ask me anything about this product.First message
widget_positionrightright or left
ai_provider''Selected connector
brand_voice''Brand voice instruction
category_scope[]Category IDs to limit the assistant to
widget_color#1a1a1aPrimary colour
widget_icon''Custom launcher icon URL
show_on_cart / show_on_checkoutfalsePage visibility
multilingualfalseMultilingual replies
handoff_email / handoff_url / handoff_label''Live Agent Handoff
nudge_exit_intentfalseExit-intent nudge
nudge_idle_seconds0Idle nudge
enable_voice / enable_imagefalseMultimodal inputs
enable_upsells / enable_search / enable_returns / enable_multi_agenttrueFeatures
return_window_days30Return window
enable_kbtrueUse the knowledge base