1. Home
  2. Hooks & Filter for Reminder Emails

Hooks & Filter for Reminder Emails

How can I hide tax in the email and other places where Tax is displayed such as Abandoned Orders details page?

Hook
wcap_show_taxes

Usage:

add_filter( 'wcap_show_taxes', 'wcap_show_taxes', 10, 1 );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function wcap_show_taxes() {
     return false;
}
add_filter( 'wcap_show_taxes', 'wcap_show_taxes', 10, 1 );

How can I hide the SKU in email?

Hook
wcap_product_sku

Usage:

add_filter( 'wcap_product_sku', 'wcap_item_sku', 10 , 2 );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function wcap_item_sku( $wcap_product_sku ) {
     return false;
}
add_filter( 'wcap_product_sku', 'wcap_item_sku', 10 , 2 );

How can I send the abandoned cart reminder email if the cart total is 0?

Hook
wcap_cart_total

Usage:

add_filter( 'wcap_cart_total', 'wcap_item_cart_total', 10 , 2 );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function wcap_item_cart_total( $return_value, $cart_id) {
  return true;
}
add_filter( 'wcap_cart_total', 'wcap_item_cart_total', 10 , 2 );

How can I change the coupon expiry date of unique generated coupon code from default 7 days?

Hook
wcap_coupon_expiry_date

Usage:

add_filter( 'wcap_coupon_expiry_date','wcap_coupon_expiry_date' ,10 ,2 );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function wcap_coupon_expiry_date( $expiry_date_extend ) {
  $wcap_expiry_date_extend          = date( "Y-m-d", strtotime( date( 'Y-m-d' ) . " +7 days" ) );
  return $wcap_expiry_date_extend;
}
add_filter( 'wcap_coupon_expiry_date','wcap_coupon_expiry_date' ,10 ,2 );

How can I add more coupon meta data for unique coupons generated for reminder emails?

Hook
wcap_update_unique_coupon_post_meta_email

Usage:

add_filter( 'wcap_update_unique_coupon_post_meta_email', 'wcap_add_custom_post_meta', 10, 2 );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function wcap_add_custom_post_meta( $coupon_code, $coupon_post_meta ) {
if ( ! is_array( $coupon_post_meta ) ) {
$coupon_post_meta = array();
}
$coupon_post_meta['minimum_amount'][0] = 700; // amount to be set.
return $coupon_post_meta;
}
add_filter( 'wcap_update_unique_coupon_post_meta_email', 'wcap_add_custom_post_meta', 10, 2 );

How can I shorten the product name in the reminder email?

Hook
wcap_product_name

Usage:

add_filter( 'wcap_product_name', 'shorten_product_name_in_abandon_cart_emails', 10, 2 ); 

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function shorten_product_name_in_abandon_cart_emails( $item_name, $product_id ) { 
  if ( 'Rent a bicycle' == $item_name ) { 
     $item_name = 'Rent a bicy..'; 
  } 
  return $item_name; 
}

add_filter( 'wcap_product_name', 'shorten_product_name_in_abandon_cart_emails', 10, 2 );

How can I change the text displayed for SKU in reminder emails (automated, manual, test & preview)?

Hook
wcap_sku_text_display

Usage:

add_filter( 'wcap_sku_text_display', 'wcap_sku_text', 10, 2 );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function wcap_sku_text( $text, $cart_lang ) {
     if ( 'en' !== $cart_lang ) {
          $text = '__( 'ISBN:', 'woocommerce-ac' );
     } else {
          $text = __( 'SKU:', 'woocommerce-ac' );
     }
     return $text;
}
add_filter( 'wcap_sku_text_display', 'wcap_sku_text', 10, 2 );

How can I add custom details in reminder emails using Custom merge tag?

Hook
wcap_replace_custom_merge_tag_email_body

Usage:

add_filter( 'wcap_replace_custom_merge_tag_email_body', 'wcap_add_custom_details', 10, 2 );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function wcap_add_custom_details( $email_body, $cart_id ) {
     if ( stripos( $email_body, '{{custom-merge-tag}}' ) > 0 ) {
	return __( 'This is a custom text which needs to be added to the email', 'woocommerce-ac' );
     } else {
	return '';
     }
}
add_filter( 'wcap_replace_custom_merge_tag_email_body', 'wcap_add_custom_details', 10, 2 );

How can I edit the checkout URL sent for SMS reminders?

Hook
wcap_checkout_link_sms_before_encoding

Usage:

add_filter( 'wcap_checkout_link_sms_before_encoding', 'change_checkout_link', 10, 3 );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function change_checkout_link( $checkout_link, $cart_id, $cart_language ) {
    if ( $cart_id > 0 ) {
        $cart_data = wcap_get_data_cart_history( $cart_id );
        if ( $cart_data ) {
            $product_list = wcap_get_product_details( $cart_data->abandoned_cart_info );
            if ( count( $product_list ) > 0 ) {
                foreach ( $product_list as $product_list ) {
                    $product_id = $product_list->product_id;
                    switch ( $product_id ) {
                        case '':
                        default: // For default or blank product ID, return standard Checkout page link without any changes.
                            return $checkout_link;
                        case '843': // product ID.
                        case '860': // product ID.
                        case '899': // product ID.
                            return 'https://staging.tychesoftwares.com/woo_pinal/lets-keep-in-touch/';
                        case '434': // product ID.
                            return 'https://staging.tychesoftwares.com/woo_pinal/sample-page/';
                    }
                }
            }
        }
    }
    return $checkout_link; // No match found, make no changes to the link.
}
add_filter( 'wcap_checkout_link_sms_before_encoding', 'change_checkout_link', 10, 3 );

How can I modify the product Image URL in reminder emails?

Hook
wcap_email_product_image_url

Usage:

add_filter( 'wcap_email_product_image_url', 'change_prd_image_url', 10, 2 );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function change_prd_image_url( $url, $cart_item ) {
     $product_id = $cart_item->product_id;
     if ( '843' === $product_id ) {
          $url = 'custm url of my choice';
     }
     return $url;
}
add_filter( 'wcap_email_product_image_url', 'change_prd_image_url', 10, 2 );

How can I modify the product price in reminder emails?

Hook
wcap_email_product_price

Usage:

add_filter( 'wcap_email_product_price', 'change_product_price', 10, 2 );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function change_product_price( $price, $product_id ) {
     if ( '843' === $product_id ) {
          $price = wc_price( 45 ); //Discounted price.
     }
     return $price;
}
add_filter( 'wcap_email_product_price', 'change_product_price', 10, 2 );

How can I modify the product quantity in reminder emails?

Hook
wcap_email_quantity

Usage:

add_filter( 'wcap_email_quantity', 'change_product_qty', 10, 2 );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function change_product_qty( $qty, $product_id ) {
     if ( '843' === $product_id ) {
          $qty = 2; //Discounted price.
     }
     return $qty;
}
add_filter( 'wcap_email_quantity', 'change_product_qty', 10, 2 );

How can I modify the product name to remove the variation details?

Hook
wcap_add_variation_in_product_name

Usage:

add_filter( 'wcap_add_variation_in_product_name', 'hide_variations', 10, 1 );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function hide_variations( $show_variations ) {
     return false; // false: hide | true: show
}
add_filter( 'wcap_add_variation_in_product_name', 'hide_variations', 10, 1 );

How can I modify the Checkout link in reminder emails?

Hook
wcap_checkout_link_email_before_encoding

Usage:

add_filters( 'wcap_checkout_link_email_before_encoding', 'update_checkout_link', 10, 3 );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function update_checkout_link( $wc_link, $cart_id, $cart_lang ) {
     $cart_data = wcap_get_data_cart_history( $cart_id );
     if ( $cart_data ) {
          $cart_details= wcap_get_product_details( $cart_data->abandoned_cart_info );
          ... add checks as needed...
          $wc_link = [custom link of your choice]
     }
     return $wc_link;
}
add_filters( 'wcap_checkout_link_email_before_encoding', 'update_checkout_link', 10, 3 );

How can I edit Product Name in reminder emails (variable products)?

Hook
wcap_after_variable_product_name

Usage:

add_filter( 'wcap_after_variable_product_name', 'add_text', 10, 2 );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function add_text( $product_name_with_vars, $product_id ) {
     $product_name_with_vars .= 'Adding custom text';
     return $product_name_with_vars;
}
add_filter( 'wcap_after_variable_product_name', 'add_text', 10, 2 );

How can I modify the email heading for notifications sent to admin when a cart is abandoned (v9.3.0 onwards)?

Hook
wcap_admin_notification_heading

Usage:

add_filter( 'wcap_admin_notification_heading', 'modify_heading', 10, 1 );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function modify_heading( $heading ) {
     $heading = __( 'Details about the abandoned cart', 'woocommerce-ac' );
     return $heading;
}
add_filter( 'wcap_admin_notification_heading', 'modify_heading', 10, 1 );

How can I modify the email subject for notifications sent to the admin when a cart is abandoned (v9.3.0 onwards)?

Hook
wcap_admin_notification_subject

Usage:

add_filter( 'wcap_admin_notification_subject', 'modify_subject', 10, 1 );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function modify_subject( $subject ) {
    $subject = __( 'A cart has been abandoned', 'woocommerce-ac' );
    return $subject;
}
add_filter( 'wcap_admin_notification_subject', 'modify_subject', 10, 1 );

How can I add more content to the customer details section in the notification sent to the admin when a cart is abandoned (v9.3.0 onwards)?

Hook
wcap_admin_notification_email_customer_details

Usage:

add_action( 'wcap_admin_notification_email_customer_details', 'add_customer_details' );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function add_customer_details() {
    $country = 'IN';
    echo esc_html( sprintf( __( 'Country: %s', 'woocommerce-ac' ), $country ) );
}
add_action( 'wcap_admin_notification_email_customer_details', 'add_customer_details' );

How can I add more content before the email footer in the notification sent to the admin when a cart is abandoned (v9.3.0 onwards)?

Hook
wcap_admin_notification_email_above_footer

Usage:

add_action( 'wcap_admin_notification_email_above_footer', 'add_custom_text' );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function add_custom_text() {
    echo __( 'These are some custom notes', 'woocommerce-ac' );
}
add_action( 'wcap_admin_notification_email_above_footer', 'add_custom_text' );

How can I display Shipping charges in reminder emails (v9.3.0 onwards)?

Hook
wcap_show_shipping_reminders

Usage:

add_action( 'wcap_show_shipping_reminders', 'show_shipping', 10, 1 );

Example:

/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function show_shipping( $show_shipping ) {
    return true;
}
add_action( 'wcap_show_shipping_reminders', 'show_shipping', 10, 1 );
Was this article helpful to you? Yes No

How can we help?