VAT
Your cart

Your cart is empty.

General hooks

This page lists the 7 hooks of this group. Each entry shows its type, the version it arrived in, where it runs, its arguments and a starting point.

addochat_added_to_cart

ActionSince 0.2.0 Runs in src/Cart/Cart.php.

Fires when the widget put a product of the chat in the cart of the visitor.

ArgumentTypeDescription
$conversationarray<string, mixed>Conversation row.
$productintProduct or variation id.
$qtyintQuantity.
$message_idintMessage with the offer.
add_action( 'addochat_added_to_cart', function ( $conversation, $product, $qty, $message_id ) {
	// ...
}, 10, 4 );

addochat_admin_language

FilterSince 0.1.0 Runs in src/Support/Language.php.

Filters the language the settings screen shows texts for. '' shows every language. For language plugins other than Polylang and WPML.

ArgumentTypeDescription
$localestringLocale chosen in the admin, '' for all languages.
add_filter( 'addochat_admin_language', function ( $locale ) {
	return $locale;
} );

addochat_cart_item

FilterSince 0.2.0 Runs in src/Cart/Products.php.

Filters a product the chat offers for the cart (by the assistant or a rule). Change the quantity or set add to false to only link to the product, or return null to leave the product out.

ArgumentTypeDescription
$itemarray<string, mixed>|nullproduct (id), qty, title, text, price, image, url, add (bool).
$product\WC_ProductThe product.
add_filter( 'addochat_cart_item', function ( $item, $product ) {
	return $item;
}, 10, 2 );

addochat_rule_matches

FilterSince 0.2.0 Runs in src/Rules/Rules.php.

Filters whether a rule matches, for example to add a condition of your own (stored in the rule by a filter on the settings, or decided from the context).

ArgumentTypeDescription
$matchedboolWhether the conditions of AddoChat hold (false when the rule has none).
$rulearray<string, mixed>Rule.
$contextarray<string, mixed>message, first, page, language, logged_in, settings.
add_filter( 'addochat_rule_matches', function ( $matched, $rule, $context ) {
	return $matched;
}, 10, 3 );

addochat_tracking_allowed

FilterSince 0.2.0 Runs in src/Visits/Route.php.

Filters whether this page view is stored. The consent the browser checks (WP Consent API) comes first; use this filter for a consent tool of your own, or to skip some visitors.

ArgumentTypeDescription
$allowedboolWhether the view is stored. Default true.
$contextarray<string, mixed>url, title and mode (consent or always).
add_filter( 'addochat_tracking_allowed', function ( $allowed, $context ) {
	return $allowed;
}, 10, 2 );

addochat_visit_recorded

ActionSince 0.2.0 Runs in src/Visits/Route.php.

Fires after a new page view was stored (not on its heartbeats).

ArgumentTypeDescription
$visitarray<string, mixed>The view: url, title, referrer, entered_at and more.
$conversation_idintConversation of the visitor, 0 for none.
add_action( 'addochat_visit_recorded', function ( $visit, $conversation_id ) {
	// ...
}, 10, 2 );

addochat_visit_url

FilterSince 0.2.0 Runs in src/Visits/Route.php.

Filters the address of a page view before it is stored. Return '' to store nothing for this page, or a shorter address (for example without the order number of a thank-you page).

ArgumentTypeDescription
$urlstringAddress of this site, without fragment and without key, token and campaign arguments.
add_filter( 'addochat_visit_url', function ( $url ) {
	return $url;
} );

Ready to connect your AI to real tools?

Start free trial