Actions and filters

Along with the customization options available in plugin settings, CartBounty also allows the use of different hooks for advanced customization. These hooks are an excellent way if you are looking to alter or extend the features of CartBounty without modifying the core files of the plugin.

Below you will find a list of hooks available in CartBounty alongside different examples. When using these actions and filters to modify the plugin, please add your code in the functions.php file of your theme.

1. Introduction to hooks

Here is the official WordPress definition of hooks: Hooks are a way for one piece of code to interact/modify another piece of code at specific, pre-defined spots. They make up the foundation for how plugins and themes interact with WordPress Core.

WordPress offers two types of hooks: actions and filters. Actions allow to add additional data or change how plugin or themes operates. Filters provide the ability to alter data during execution of plugins and themes.

2. General hooks

These are general hooks available in CartBounty for various operations like changing phone validation, email address, time after which the abandoned cart is considered to be abandoned etc.

Filters:

  1. cartbounty_pro_from_email
  2. cartbounty_pro_waiting_time
  3. cartbounty_pro_phone_validation
  4. cartbounty_pro_include_tax
  5. cartbounty_pro_recaptcha_minimum_allowed_score
  6. cartbounty_pro_bot_list
  7. cartbounty_pro_set_excluded_ip_addresses
  8. cartbounty_pro_price_format
  9. cartbounty_pro_display_currency_code
  10. cartbounty_pro_coupon_expiry_date_format
  11. cartbounty_pro_unfinished_order_statuses
  12. cartbounty_pro_landing_url
  13. cartbounty_pro_cart_url_utm_tracking
  14. cartbounty_pro_coupon_auto_apply
  15. cartbounty_pro_default_country
  16. cartbounty_pro_international_phone_preferred_countries
  17. cartbounty_pro_display_full_address
  18. cartbounty_pro_custom_product_fields
  19. cartbounty_pro_export_columns
  20. cartbounty_pro_excluded_countries
  21. cartbounty_pro_excluded_languages
  22. cartbounty_pro_minimum_cart_total
  23. cartbounty_pro_save_custom_email
  24. cartbounty_pro_custom_email_selector_timeout
  25. cartbounty_pro_custom_email_selectors
  26. cartbounty_pro_get_template_path
  27. cartbounty_pro_edit_cart_cooldown_period

Edit “From” email address

Here is an example how to replace the default “From” email that is used for sending notification emails using cartbounty_pro_from_email filter.

function change_from_email( $html ){
	return 'your@email.com';
}
add_filter( 'cartbounty_pro_from_email', 'change_from_email' );

Edit cart abandonment time

Example how to edit the default waiting time after which the cart is considered abandoned from 60 minutes (default time) to 30 minutes using cartbounty_pro_waiting_time filter. Note that the minimum allowed time is 20 minutes.

function change_waiting_time( $minutes ){
	return 30; //Minimum allowed time is 20 minutes
}
add_filter( 'cartbounty_pro_waiting_time', 'change_waiting_time' );

Disable phone validation

Here is an example how to disable the default phone validation of Exit Intent and Early capture popups.

function cartbounty_pro_disable_phone_validation( $regex ){
	return '';
}
add_filter( 'cartbounty_pro_phone_validation', 'cartbounty_pro_disable_phone_validation' );

Edit phone validation

Example how to change phone number validation RegEx that will allow only US phone numbers with area code (i.e., 111-222-3333, or 111.222.3333, or (111) 222-3333, or 1112223333, etc.).

function cartbounty_pro_change_phone_validation( $regex ){
	return '^\D?(\d{3})\D?\D?(\d{3})\D?(\d{4})$';
}
add_filter( 'cartbounty_pro_phone_validation', 'cartbounty_pro_change_phone_validation' );

Abandoned cart product prices without taxes

Please use this snippet, if you would like to display abandoned cart product prices without taxes.

add_filter( 'cartbounty_pro_include_tax', '__return_false' );

Adjust Google reCAPTCHA sensitivity

In the example below we have raised the sensitivity from the default 0.2 to 0.3 – now only visitors that will receive a score of 0.3 or higher will be saved in the abandoned cart table.

function cartbounty_pro_change_score( $score ) {
	return 0.3;
}
add_filter( 'cartbounty_pro_recaptcha_minimum_allowed_score', 'cartbounty_pro_change_score' );

Edit known bot list to allow or disallow bots leaving abandoned carts

CartBounty uses a list of more than 160 most popular bots to determine if a visitor is a real person or a bot. By editing this list, you can allow or disallow specific bots from leaving abandoned carts on your store. Please use this example to add a new bot to the list and prevent it from creating abandoned carts.

function cartbounty_pro_add_new_bot( $existing_bots ){
	//$existing_bots is an array containing all known bots CartBounty includes
	$existing_bots[] = 'Name of the new bot';
	return $existing_bots;
}
add_filter( 'cartbounty_pro_bot_list', 'cartbounty_pro_add_new_bot' );

Here’s an example of how to remove “Googlebot” from the list, in case it’s needed.

function cartbounty_pro_remove_bot( $existing_bots ){
	//$existing_bots is an array containing all known bots CartBounty includes
	$existing_bots = array_diff( $existing_bots, array( 'Googlebot' ) );
	return $existing_bots;
}
add_filter( 'cartbounty_pro_bot_list', 'cartbounty_pro_remove_bot' );

Exclude specific IP addresses from creating abandoned carts

Filter out unwanted IP addresses that frequently create abandoned shopping carts by adding them to the exclusion list. Once these IP addresses are added, any abandoned carts generated from them will no longer be saved.

To find the IP address of a specific abandoned cart, please export the abandoned cart data and locate the IP address column within the exported file

function cartbounty_pro_set_excluded_ip_addresses(){
    $ip = array(
        '255.255.255.255',
        '256.256.256.256',
    );
    return $ip;
}
add_filter( 'cartbounty_pro_excluded_ip_addresses', 'cartbounty_pro_set_excluded_ip_addresses' );

Customize price format

CartBounty displays prices according to WooCommerce currency settings. If you would like to override this – use the below example of how to format the price with currency positioned on the right with a space between the price, e.g. 28 $.

function cartbounty_pro_change_price_format(){
	//Currency to the left - %1$s%2$s
	//Currency to the right - %2$s%1$s
	//Currency to the left with space - %1$s %2$s
	//Currency to the right with space - %2$s %1$s
	return '%2$s %1$s';
}
add_filter( 'cartbounty_pro_price_format', 'cartbounty_pro_change_price_format' );

Display currency code instead of symbol

Please use the example below if you would like to output currency code like USD or EUR instead of $ or € symbol in the abandoned cart table and WordPress recovery emails.

function cartbounty_pro_enable_currency_code(){
	return true;
}
add_filter( 'cartbounty_pro_display_currency_code', 'cartbounty_pro_enable_currency_code' );

Change coupon expiration date format

By default coupon expiration date is formatted and displayed as 2021-08-21 (year-month-date), but it is possible to easily change the formatting via a filter.

/**
 * Other alternative examples if we assume the expiration date is set to August 21st, 2021
 * 'Y-m-d'		2021-08-21 (Default)
 * 'Y-d-m'		2021-21-08
 * 'd.m.Y'		21.08.2021
 * 'F dS, Y'	        August 21st, 2021
 * 'M d, Y'		Aug 21, 2021
 */
function cartbounty_change_coupon_expiry_date_format(){ 
	return 'Y-d-m';
}
add_filter( 'cartbounty_pro_coupon_expiry_date_format', 'cartbounty_change_coupon_expiry_date_format' );

Add additional status to unfinished orders list

Please use this snippet if you would like to add additional status to unfinished orders list using a filter instead of CartBounty settings.

function cartbounty_update_unfinished_order_statuses( $statuses ){
    $statuses[] = 'cancelled';
    return $statuses;
}
add_filter( 'cartbounty_pro_unfinished_order_statuses', 'cartbounty_update_unfinished_order_statuses' );

Change landing page

Checkout page is the default page customer is taken to after restoring cart from abandoned cart recovery email or text message. Use the following snippet to change this to WooCommerce cart page or a custom link.

function cartbounty_landing_url(){ 
    return 'cart'; // Available options: checkout (default), cart, custom link starting with https://
}
add_filter( 'cartbounty_pro_landing_url', 'cartbounty_landing_url' );

Add UTM tracking tags to abandoned cart recovery URL

CartBounty to add UTM tracking tags to links which are sent to customers in abandoned cart reminders. Once the link is clicked and customer has arrived at your store, these tags can be picked up by your tracking mechanism to have a better understanding of how well your campaigns are doing.

Please use this as an example that shows how to add 3 custom tags (utm_campaign, utm_medium and utm_source) with appropriate values to CartBounty abandoned cart reminder URL.

function cartbounty_pro_add_cart_url_utm_tracking(){
    return 'utm_campaign=recovery&utm_medium=social&utm_source=instagram';
}
add_filter( 'cartbounty_pro_cart_url_utm_tracking', 'cartbounty_pro_add_cart_url_utm_tracking' );

Stop automatic coupon application

Do not auto apply coupon code to the shopping cart once customer returns from recovery message (email or SMS).

add_filter( 'cartbounty_pro_coupon_auto_apply', '__return_false' );

Set custom preferred countries used by easy international phone input

CartBounty uses default WooCommerce base country as default country for validating phone numbers without area code as well as to display initial area code if Easy international input enabled. If you would like to keep your default store base country but would like to have a different country used by CartBounty, please use this example.

add_filter( 'cartbounty_pro_default_country', 'cartbounty_pro_change_default_country' );
function cartbounty_pro_change_default_country(){
    return 'US';
}

Set custom preferred countries used by easy international phone input

When easy international phone input is enabled, customers can select their area code from a drop-down list. To improve user experience, it is possible to edit which countries appear first in the list using the following example which moves United States, Canada and United Kingdom to the top of the list.

add_filter( 'cartbounty_pro_international_phone_preferred_countries', 'cartbounty_pro_add_phone_input_preferred_countries' );
function cartbounty_pro_add_phone_input_preferred_countries(){
    return array( 'US', 'CA', 'GB' );
}

Output full address in the location column

CartBounty does not output full customer address in the abandoned cart list. However, if it is necessary to display full customer address, it is possible to do using a filter.

add_filter( 'cartbounty_pro_display_full_address', '__return_true' );

Save custom product field plugin data

There are various WooCommerce plugins that allow adding extra product options and collect additional details from customers when adding a product to shopping cart (e.g., customer notes, dates, engrave texts etc.). CartBounty can save and restore custom product data from these plugins:

However, it is possible to add support for other custom product addon plugins using a filter and passing an additional array element into existing array.

function cartbounty_pro_edit_custom_product_fields( $fields ){
    $fields[] = 'your_custom_field_label';
    return $fields;
}
add_filter( 'cartbounty_pro_custom_product_fields', 'cartbounty_pro_edit_custom_product_fields' );

Limit exported abandoned cart table columns

CartBounty allows to export abandoned cart data. By default, all abandoned cart table columns are exported however it is possible to use a filter to specify exported columns. Here is an example how to include only Abandoned cart ID, customer email, name, and surname.

function cartbounty_pro_update_export_columns( $columns ){
    $columns = 'id, email, name, surname';
    return $columns;
}
add_filter( 'cartbounty_pro_export_columns', 'cartbounty_pro_update_export_columns' );

Please note that it is required to include id, email, and session_id fields to see abandoned cart recovery link column added to exported data.

Exclude specific countries from abandoned cart recovery

It is possible to exclude specified countries from receiving abandoned cart reminders. Please use this example to achieve it. Note that this is a global filter will also affect which abandoned carts will be synced to external services like ActiveCampaign, MailChimp etc.

function cartbounty_pro_set_excluded_countries( $countries ){
    $countries[] = 'LV'; //Replace this with country code that needs to be excluded
    $countries[] = 'US'; //Remove this line or add multiple ones to exclude multiple countries from receiving abandoned cart messages
    return $countries;
}
add_filter( 'cartbounty_pro_excluded_countries', 'cartbounty_pro_set_excluded_countries' );

Exclude customers using specific languages from abandoned cart recovery

Use this example to exclude customers using specific languages from receiving abandonment reminders.

function cartbounty_pro_set_excluded_languages( $languages ){
    $languages[] = 'en_US'; //Adding WordPress language locale code to exclusions
    $languages[] = 'lv_LV'; //Adding WordPress language locale code to exclusions
    return $languages;
}
add_filter( 'cartbounty_pro_excluded_languages', 'cartbounty_pro_set_excluded_languages' );

Exclude shopping carts from recovery that do not exceed minimum cart total

There is an option to exclude customers with specific cart total value from receiving reminders. Please use the example below to set minimum cart total value. If the cart total value is below the minimum set value, customer will not receive a reminder.

function cartbounty_pro_set_minimum_cart_total( $value ){
    $value = 50;
    return $value;
}
add_filter( 'cartbounty_pro_minimum_cart_total', 'cartbounty_pro_set_minimum_cart_total' );

Save abandoned cart email using a custom input field

CartBounty has built-in integrations with more than 20 different most popular popup, forms and newsletter plugins that enables saving recoverable abandoned carts from 3rd party plugins. However if you have a custom email input field on your page and you would like to use it for saving abandoned cart data, please use the following example below.

function cartbounty_add_custom_email_field_selector( $selectors ){
    $selectors[] = '.my-custom-email-field-class'; //Use the class or ID of your custom email input field here
    return $selectors;
}
add_filter( 'cartbounty_pro_custom_email_selectors', 'cartbounty_add_custom_email_field_selector' );

Change CartBounty template path

If you find yourself in a position where you need to change the location where you keep all of your CartBounty template files (e.g., you are using Oxygen plugin that disables active theme), you may follow these steps:

  1. Install and activate My Custom Functionality plugin
  2. Copy templates folder from /wp-content/plugins/woo-save-abandoned-carts-pro/templates over to /wp-content/plugins/my-custom-functionality-master plugin folder
  3. Add this code to /wp-content/plugins/my-custom-functionality-master/plugin.php file
function cartbounty_pro_add_custom_template_path( $template, $template_name, $template_path, $default_path ){

    $base_folder = array(
        'cartbounty-pro-exit-intent.php',
        'cartbounty-pro-early-capture.php',
        'cartbounty-pro-push-notification-request.php'
    );

    $emails_folder = array(
        'cartbounty-pro-admin-email-notification.php',
        'cartbounty-pro-email-row-contents.php',
        'cartbounty-pro-email-column-contents.php',
        'cartbounty-pro-email-light.php'
    );

    if( in_array( $template_name, $base_folder ) ){
        $template = plugin_dir_path( __FILE__ )  . 'templates/' . $template_name;

    }elseif( in_array( $template_name, $emails_folder ) ){
        $template = plugin_dir_path( __FILE__ )  . 'templates/emails/' . $template_name;
    }

    return $template;
}

add_filter( 'cartbounty_pro_get_template_path', 'cartbounty_pro_add_custom_template_path', 10, 4 );

Change cart cooldown period

CartBounty uses a 2 hour cooldown period to prevent the creation of new abandoned carts during the same session after a user has already placed a new order. Once the cooldown period ends, a new cart will be created for the same user in the same session.

Cooldown has been introduced to prevent customers from receiving abandoned cart reminder messages for products they have already purchased. If you would like to adjust this period or completely disable it, you can use a filter. In the example below we are changing the default cooldown period from two hours to 30 minutes.

function cartbounty_pro_edit_cart_cooldown_period( $cooldown_period ){
    // $period = '-0 minutes'; //No cooldown period
    $period = '-30 minutes'; //Set cooldown period to 30 minutes
    // $period = '-1 hour'; //Set cooldown period to 1 hour
    // $period = '-12 hours'; //Set cooldown period to 12 hours
    // $period = '-1 day'; //Set cooldown period to 1 day or 24 hours
    
    $cooldown_period = date( 'Y-m-d H:i:s', strtotime( $period, strtotime( current_time( 'mysql' ) ) ) );
    return $cooldown_period;
}

add_filter( 'cartbounty_pro_cart_cooldown_period', 'cartbounty_pro_edit_cart_cooldown_period' );

3. WordPress recovery email hooks

WordPress recovery offers different email templates and each of them can be used in its own automation step. Actions and filters therefore make use of two variables – template_name which defines the template used (available strings are “light”, “rows” and “columns”) and step_number which defines the automation step (available numbers are “1”, “2” and “3”).

Actions:

  1. cartbounty_pro_automation_{template_name}_before_title_{step_number}
  2. cartbounty_pro_automation_{template_name}_after_title_{step_number}
  3. cartbounty_pro_automation_{template_name}_after_intro_{step_number}
  4. cartbounty_pro_automation_{template_name}_after_button_{step_number}
  5. cartbounty_pro_automation_{template_name}_footer_start_{step_number}
  6. cartbounty_pro_automation_{template_name}_footer_end_{step_number}

Filters:

  1. cartbounty_pro_automation_{template_name}_title_html_{step_number}
  2. cartbounty_pro_automation_{template_name}_intro_html_{step_number}
  3. cartbounty_pro_automation_{template_name}_button_html_{step_number}
  4. cartbounty_pro_automation_copyright
  5. cartbounty_pro_automation_footer_address_1
  6. cartbounty_pro_automation_footer_address_2
  7. cartbounty_pro_automation_unsubscribe_html
  8. cartbounty_pro_automation_max_products
  9. cartbounty_pro_wordpress_recovery_args
  10. cartbounty_pro_wordpress_recovery_email_bcc
Action and filter scheme of WordPress recovery email
Action and filter scheme of WordPress recovery email

Include additional content before the main title

Example how to add additional content right before the main title inside the “Light” template if it is used in the 1st WordPress recovery reminder email step.

function cartbounty_pro_add_light_title_on_step_one(){
	esc_html_e( 'Additional content before main title', 'woo-save-abandoned-carts' );
}
add_action( 'cartbounty_pro_automation_light_before_title_1', 'cartbounty_pro_add_light_title_on_step_one' );

Edit main title

How to use a filter to alter the main title of the “With cart contents” template if it is used in the 2nd automation step.

function cartbounty_pro_alter_rows_title_on_step_two( $title ){
	return '<h1 style="font-size: 60px; padding-bottom: 30px;">'. __('My new title', 'woo-save-abandoned-carts') .'</h1>';
}
add_filter( 'cartbounty_pro_automation_rows_title_html_2', 'cartbounty_pro_alter_rows_title_on_step_two' );

Change “Complete checkout” button name

How to replace existing button name from “Complete checkout” to “Return to cart” inside the “With cart contents” template for each automation step.

function cartbounty_pro_alter_rows_template_buttons( $button ){
    return str_replace( 'Complete checkout', __('Return to cart', 'woo-save-abandoned-carts') , $button);
}
add_filter( 'cartbounty_pro_automation_rows_button_html_1', 'cartbounty_pro_alter_rows_template_buttons' ); //Changing button name in the 1st reminder step
add_filter( 'cartbounty_pro_automation_rows_button_html_2', 'cartbounty_pro_alter_rows_template_buttons' ); //Changing button name in the 2nd reminder step
add_filter( 'cartbounty_pro_automation_rows_button_html_3', 'cartbounty_pro_alter_rows_template_buttons' ); //Changing button name in the 3rd reminder step

How to change the default footer address. By default, it is taken from WooCommerce store address you have entered, but you can change it using a filter.

function cartbounty_pro_alter_footer_address_1( $address ){
    esc_html_e('First address line...', 'woo-save-abandoned-carts');
}
add_filter( 'cartbounty_pro_automation_footer_address_1', 'cartbounty_pro_alter_footer_address_1' );

function cartbounty_pro_alter_footer_address_2( $address ){
    esc_html_e('Second address line...', 'woo-save-abandoned-carts');
}
add_filter( 'cartbounty_pro_automation_footer_address_2', 'cartbounty_pro_alter_footer_address_2' );

Change the maximum number of products

How to change the maximum number of products that are presented in the reminder email to 9 products.

function cartbounty_pro_alter_max_products(){
    return 9;
}
add_filter( 'cartbounty_pro_automation_max_products', 'cartbounty_pro_alter_max_products' );

Add Bcc email address to WordPress Recovery emails

If you add an email address to the Bcc field it means that a copy of the abandoned cart reminder email that will be sent to customer will also be sent to address inside Bcc field, however the customer receiving this reminder email will not be able to see the address in the Bcc field.

Here is an example how to add two Bcc emails to WordPress Recovery reminder emails.

function cartbounty_pro_add_wordpress_recovery_email_bcc(){
    $emails = "first@email.com, second@email.com";
    return $emails;
}
add_filter( 'cartbounty_pro_wordpress_recovery_email_bcc', 'cartbounty_pro_add_wordpress_recovery_email_bcc' );

4. Push notification hooks

Push notification recovery offers a permission request template which allows for some advanced customization via hooks. Besides that CartBounty also includes hooks that can be used to fine-tune and adjust how cart abandonment push notifications look and work.

Actions:

  1. cartbounty_pro_push_notification_permission_start
  2. cartbounty_pro_push_notification_permission_after_title
  3. cartbounty_pro_push_notification_permission_end

Filters:

  1. cartbounty_pro_push_notification_permission_close_html
  2. cartbounty_pro_push_notification_permission_image_html
  3. cartbounty_pro_push_notification_permission_title_html
  4. cartbounty_pro_push_notification_permission_description_html
  5. cartbounty_pro_push_notification_permission_button_html
  6. cartbounty_pro_push_notification_soft_ask_enabled
  7. cartbounty_pro_push_notification_soft_ask_reset_hours
  8. cartbounty_pro_push_notification_soft_ask_backdrop
  9. cartbounty_pro_push_notification_scope
  10. cartbounty_pro_push_notification_permission_args
  11. cartbounty_pro_push_notification_recovery_args
  12. cartbounty_pro_push_notification_vapid_subject
Web push notification permission request (soft-ask) scheme
Web push notification permission request (soft-ask) scheme

Disable soft-ask permission request

If push notifications are enabled, CartBounty will start collecting notification subscriptions using a soft-ask form that will be displayed as soon as user has added an item to the cart and it is no longer empty. However it is also possible to disable soft-ask request and instead directly request notification permission. It is not recommended since not all browsers allow this and it is creating a bad user experience, however if you require it, you can use line of code.

add_filter( 'cartbounty_pro_push_notification_soft_ask_enabled', '__return_false' );

Customize advanced push notification options

You can customize all major push notification components under push notification settings. However there are some other options that can be adjusted to change push notification behavior and looks. Here is an example you can use to customize them.

function cartbounty_pro_edit_push_notification_recovery_args( $args ){
    /* $args array example
    'title' = '',
    'options' = [
        'body' = '',
        'icon' = '',
        'image' = '',
        'data' = [
            'url' = ''
        ],
        'actions' = [],
        'dir' = '',
        'renotify' = '',
        'requireInteraction' = '',
        'silent' = '',
        'tag' = '',
        'vibrate' = '',
        'badge' = '',
    ] */

    $args['options']['badge'] = 'www.test.com/image/badge.png'; //Setting push notification badge
    return $args;
}
add_filter( 'cartbounty_pro_push_notification_recovery_args', 'cartbounty_pro_edit_push_notification_recovery_args' );

5. BulkGate recovery hooks

Filters:

  1. cartbounty_pro_bulkgate_unicode

Force disable Unicode characters

When sending BulkGate text messages (SMS), CartBounty will automatically check weather reminder message contain Unicode characters or not and will instruct BulkGate enable or disable Unicode sending mode. To disable this behavior and force all messages to be sent as non-Unicode messages, please use this snippet.

add_filter( 'cartbounty_pro_bulkgate_unicode', '__return_false' );

6. Webhook recovery hooks

Abandoned cart recovery using Webhook comes with a couple of filters that help customize and adjust how data is delivered over to external systems.

Filters:

  1. cartbounty_pro_webhook_method_get
  2. cartbounty_pro_webhook_method_post
  3. cartbounty_pro_webhook_method_delete

Change how data is delivered over to external systems

Webhook that is built inside CartBounty is based on three main methods for communicating data with external systems. They are as follows:

  • GET (used to retrieve information about connection status)
  • POST (used to send abandoned cart data over to external webhook)
  • DELETE (used to send abandoned cart deletion requests)

If you need to change one or all of them, you can do so by using appropriate filters. Here is an example how to change GET and DELETE methods to POST.

function cartbounty_pro_webhook_method_change(){
    return 'POST';
}

add_filter( 'cartbounty_pro_webhook_method_get', 'cartbounty_pro_webhook_method_change' );
add_filter( 'cartbounty_pro_webhook_method_delete', 'cartbounty_pro_webhook_method_change' );

7. Admin notification email hooks

Admin notification email template includes various actions and filters that allow to customize how the information about a newly abandoned or recovered cart is presented to the store administrator or manager.

Actions:

  1. cartbounty_pro_admin_email_before_title
  2. cartbounty_pro_admin_email_after_title
  3. cartbounty_pro_admin_email_after_intro
  4. cartbounty_pro_admin_email_after_button
  5. cartbounty_pro_admin_email_footer_end

Filters:

  1. cartbounty_pro_admin_email_title_html
  2. cartbounty_pro_admin_email_intro_html
  3. cartbounty_pro_admin_email_button_html
  4. cartbounty_pro_admin_notification_args
  5. cartbounty_pro_notification_max_products
  6. cartbounty_pro_admin_notification_cc
  7. cartbounty_pro_admin_notification_bcc
  8. cartbounty_pro_admin_anonymize_notification_email
  9. cartbounty_pro_admin_anonymize_notification_phone

Adjust maximum product count in admin notification email cart contents

By default admin notification email for each abandoned cart will display up to 10 products in the cart. If you feel like you require to see more in this notification email, you can use this example snippet that increases maximum product count to 25.

function cartbounty_pro_alter_notification_max_products(){
    return 25;
}
add_filter( 'cartbounty_pro_notification_max_products', 'cartbounty_pro_alter_notification_max_products' );

Add Bcc email address to admin notification emails

Here is an example how to add Bcc email to CartBounty admin notification emails. Similar code can be used to add Cc field. When entering multiple email addresses, they must be separated by a comma.

function cartbounty_pro_add_admin_notification_bcc(){
    $email = "email@email.com";
    return $email;
}
add_filter( 'cartbounty_pro_admin_notification_bcc', 'cartbounty_pro_add_admin_notification_bcc' );

Display customer email and phone inside admin notifications

When a new recoverable abandoned cart is saved or recovered, CartBounty sends out an email to the store administrator that contains user’s email, phone and cart value. Email and phone is obfuscated for the sake of personal data protection as it is not advisable to store personal data in more than one location. Since this data is available in the abandoned cart list – CartBounty is not creating another copy inside email, but rather shows a preview of this personal data.

However if you would still like to see full email and phone inside the notification email, please add this to your functions.php file.

add_filter( 'cartbounty_pro_admin_anonymize_notification_email', '__return_false' );
add_filter( 'cartbounty_pro_admin_anonymize_notification_phone', '__return_false' );

8. Exit Intent hooks

Our Exit Intent template contains different actions and filters that allow you to add new, edit, replace and remove existing content including the main image inside the popup.

Actions:

  1. cartbounty_pro_exit_intent_start
  2. cartbounty_pro_exit_intent_after_title
  3. cartbounty_pro_exit_intent_before_form_fields
  4. cartbounty_pro_exit_intent_end

Filters:

  1. cartbounty_pro_exit_intent_close_html
  2. cartbounty_pro_exit_intent_image_html
  3. cartbounty_pro_exit_intent_title_html
  4. cartbounty_pro_exit_intent_description_html
  5. cartbounty_pro_exit_intent_field_html
  6. cartbounty_pro_exit_intent_button_html
  7. cartbounty_pro_exit_intent_reset_hours
  8. cartbounty_pro_exit_intent_args
Action and filter scheme of Exit Intent popup

Change the main title

If you are looking to change the default title of Exit Intent popup, you can use cartbounty_pro_exit_intent_title_html filter and this snippet below.

function modify_title( $html ) {
	$custom_title = 'Your text here...';
	return preg_replace('#(<h2[^>]*>).*?(</h2>)#', "$1 $custom_title $2", $html);
}
add_filter( 'cartbounty_pro_exit_intent_title_html', 'modify_title' );

Edit description

If you are looking to change the default description of Exit Intent popup, you can use cartbounty_pro_exit_intent_description_html filter and this snippet below.

function modify_description( $html ){
	$custom_description = 'New description here...';
	return preg_replace('#(<p[^>]*>).*?(</p>)#', "$1 $custom_description $2", $html);
}
add_filter( 'cartbounty_pro_exit_intent_description_html', 'modify_description' );

Add a subtitle

Here is an example how to add an additional subtitle after the main title using cartbounty_pro_exit_intent_after_title action hook.

function add_extra_html_after_title() {
	echo "<p>Additional subtitle here...</p>";
}
add_action('cartbounty_pro_exit_intent_after_title', 'add_extra_html_after_title' );

Replace the image

Example how to use cartbounty_pro_exit_intent_image_html filter to replace the default image using a function.

function modify_image( $html ){
	return '<img src="http://www.link-to-your-custom-image-here..."/>';
}
add_filter( 'cartbounty_pro_exit_intent_image_html', 'modify_image' );

9. Early capture hooks

Early capture template contains different actions and filters that allow you to add new, edit, replace and remove existing content.

Actions:

  1. cartbounty_pro_early_capture_after_title
  2. cartbounty_pro_early_capture_before_form_fields

Filters:

  1. cartbounty_pro_early_capture_label_html
  2. cartbounty_pro_early_capture_close_html
  3. cartbounty_pro_early_capture_field_html
  4. cartbounty_pro_early_capture_button_html
  5. cartbounty_pro_early_capture_reset_hours
  6. cartbounty_pro_early_capture_args
  7. cartbounty_pro_early_capture_mandatory_input_hard_validation
Action and filter scheme of Early capture template after user clicks "Add to cart" button
Action and filter scheme of Early capture template

Edit appearance time interval

How to change the default time interval of how often the “Add to cart” popup request is presented from 60 to 30 minutes.

function custom_early_capture_appearance_interval( $hours ){
	return 0.5;
}
add_filter( 'cartbounty_pro_early_capture_reset_hours', 'custom_early_capture_appearance_interval' );

10. Tab notification hooks

Tab notification provides a couple of filters for additional customization which is outside the scope of what is already available under Tab notification settings.

Filters:

  1. cartbounty_pro_tab_notification_interval
  2. cartbounty_pro_tab_notification_favicon
  3. cartbounty_pro_tab_notification_favicon_relationship

Customize Tab title and Favicon speed

CartBounty Tab notification allows to choose from a list of various Intervals when Tab title and Favicon should switch. However, it is possible to use a filter to set a custom time Interval. Here is an example how to set dynamic Tab notification interval to 7 seconds.

function cartbounty_pro_change_tab_notification_interval( $interval ){
    $interval = 7000; //Value in milliseconds
    return $interval;
}

add_filter( 'cartbounty_pro_tab_notification_interval', 'cartbounty_pro_change_tab_notification_interval' );

Set a custom Favicon image URL

It is very easy to add a custom Favicon icon via CartBounty Tab notification settings. But there is a filter that allows to set a custom image URL. An example you can use to load Favicon image from an external URL.

function cartbounty_pro_change_tab_notification_favicon_url( $url ){
    $url = 'https://www.apple.com/favicon.ico';
    return $url;
}

add_filter( 'cartbounty_pro_tab_notification_favicon', 'cartbounty_pro_change_tab_notification_favicon_url' );

Customize Favicon link tag relationship

Tab notification allows to use Favicon as means of attracting customer attention and returning them to your store. In most cases Favicon is defined using <link rel="icon"> tag and CartBounty is relying on “rel” attribute. By default, CartBounty is looking for the attribute to be set to “icon” or “shortcut icon”. But in case you have different relationship, you can use a custom filter and add this attribute to the list. Here is an example where we add “favicon” attribute to the default list of attributes.

function cartbounty_pro_change_tab_notification_favicon_relationship( $relationship ){
    $relationship = 'icon, shortcut icon, favicon';
    return $relationship;
}

add_filter( 'cartbounty_pro_tab_notification_favicon_relationship', 'cartbounty_pro_change_tab_notification_favicon_relationship' );

11. Privacy and GDPR data export hooks

These hooks are intended to help with abandoned cart personal data anonymization and the default WordPress GDPR data export tool.

Filters:

  1. cartbounty_pro_anonymization_interval
  2. cartbounty_pro_export_abandoned_cart_fields
  3. cartbounty_pro_export_abandoned_cart_field
  4. cartbounty_pro_export_abandoned_cart

Edit anonymization time interval

By default, CartBounty automatically anonymizes recoverable abandoned carts after 180 days. However, you have the ability to modify this period by using a filter.

function cartbounty_pro_change_anonymization_interval(){
    $days = 360; //Changing default anonymization period to 360 days
    return $days;
}
add_filter( 'cartbounty_pro_anonymization_interval', 'cartbounty_pro_change_anonymization_interval' );

What’s next

You might also be interested in these topics:

Last updated 2 weeks ago

Support

Need premium support for CartBounty Pro?

Please use the button below, reply to your purchase receipt or contact us with e-mail including your license key. This will guarantee a faster response time.

Get Premium support
CartBounty

Don't Go Just Yet! Claim Your 5% Discount Now! 🥳

Simply provide your email and unlock an instant discount applied to your shopping cart.