Skip to content

Hooks for Reminder Emails

Pinal edited this page Apr 22, 2024 · 17 revisions

Below is the list of filters which are present in the plugin to edit content in reminder emails.

Hide/Edit the Quantity column in the reminder emails:

  1. wcal_reminder_email_qty_header - Used to edit the column name for the Quantity column in the {{products.cart}} merge tag.

Parameters: string $qty_header - Column Name for Qty.

Example:

add_filter( 'wcal_reminder_email_qty_header', 'change_qty_header', 10, 1 );
function change_qty_header( $qty_header ) {
$qty_header = 'Number of Items';
return $qty_header;
}
  1. wcal_reminder_email_qty_value - Used to edit the column value for the Quantity column in the {{products.cart}} merge tag. This filter will be run for each product row in the cart table displayed in the reminder emails.

Parameters: integer $quantity_total - Qty of the item present in the cart

Example:

add_filter( 'wcal_reminder_email_qty_value', 'change_qty_value', 10, 1 );
function change_qty_value( $quantity_total ) {
$quantity_total = ''; // No qty will be displayed.
return $quantity_total ;
}

When both the above filters return blank values, the Quantity column will be hidden in the reminder email.

Hide/Edit the Price column in reminder emails

  1. wcal_reminder_email_price_header - Used to edit the column name for the Price column in the {{products.cart}} merge tag.

Parameters: string $price_header - Column Name for Price

Example:

add_filter( 'wcal_reminder_email_price_header', 'change_price_header', 10, 1 );
function change_price_header( $price_header ) {
$price_header = 'Amount';
return $price_header;
}
  1. wcal_reminder_email_price_value - Used to edit the column value for the Price column in the {{products.cart}} merge tag.

Parameters: string $item_subtotal - Item Price in wc_price() format.

Example:

add_filter( 'wcal_reminder_email_price_value', 'change_price_value', 10, 1 );
function change_price_value( $item_subtotal) {
$item_subtotal = ''; // Hide the price.
return $item_subtotal;
}

When both the above filters return blank values, the Price column will be hidden in the reminder email.

Edit Product name in reminder emails.

  1. wcal_reminder_email_after_product_name - Used to edit the product name displayed in the Name column in the {{products.cart}} merge tag. This filter will be run for each product row in the cart table displayed in the reminder emails.

Parameters: string $product_name - Product Name to be displayed object $v - The cart details as shown in WC Cart

Example:

add_filter( 'wcal_reminder_email_after_product_name', 'change_product_name', 10, 2 );
function change_product_name( $product_name, $v ) {
$product_id = $v->product_id;
$product_name = get_the_title( $product_id );
return $product_name;
}

Hide/Edit Line Subtotal column in reminder emails.

  1. wcal_reminder_email_line_subtotal_header - Used to edit the column name for the Line Subtotal column in the {{products.cart}} merge tag. This filter will be run for each product row in the cart table displayed in the reminder emails.

Parameters: string $line_subtotal_header - Column Name for Subtotal

Example:

add_filter( 'wcal_reminder_email_line_subtotal_header', 'change_subtotal_header', 10, 1 );
function change_subtotal_header( $line_subtotal_header ) {
$line_subtotal_header = 'Subtotal';
return $line_subtotal_header;
}
  1. wcal_reminder_email_line_subtotal_value - Used to edit the column value for the Line Subtotal column in the {{products.cart}} merge tag. This filter will be run for each product row in the cart table displayed in the reminder emails.

Parameters: string $item_total_display - Line Subtotal in wc_price() format.

Example:

add_filter( 'wcal_reminder_email_line_subtotal_value', 'change_subtotal_value', 10, 1 );
function change_subtotal_value( $item_total_display) {
$item_total_display = ''; // Hide the line subtotal.
return $item_total_display;
}

When both the above filters return blank values, the Line Subtotal column will be hidden in the reminder email.

Hide/Edit the Cart total title & value.

  1. wcal_reminder_email_cart_total_title - Used to edit the Cart Total title in the {{products.cart}} merge tag.

Parameters: string $cart_total_title - Cart Total Title

Example:

add_filter( 'wcal_reminder_email_cart_total_title', 'change_total_title', 10, 1 );
function change_total_title( $cart_total_title) {
$cart_total_title = 'Total';
return $cart_total_title;
}
  1. wcal_reminder_email_cart_total - Used to edit the cart total value in the {{products.cart}} merge tag.

Parameters: string $cart_total - Cart Total as WC formatted price

Example:

add_filter( 'wcal_reminder_email_cart_total', 'change_cart_total', 10, 1 );
function change_cart_total( $cart_total) {
$cart_total = ''; // Hide the cart total.
return $cart_total;
}

When both the above filters return blank values, the Cart totals row will be hidden in the reminder email.

  1. wcal_email_sku - Used to edit the SKU of the products in the {{products.cart}} merge tag.

Parameters: string $wcap_sku - Product SKU

int $product_id - Product ID/Variation ID

Example:

add_filter( 'wcal_email_sku', 'hide_sku', 10, 2 );
function hide_sku( $sku, $product_id ) {
	$sku = '';
	return $sku;
}

When returned as blanks, the SKU will be hidden in the reminder email.

Send reminder emails even if the cart total is zero:

  1. wcal_check_cart_total - Send the abandoned cart reminder email if the cart total is 0:

Return true: Cart condition is considered matched & the reminder email will be sent.

Return false: Cart condition is considered to fail the match and the reminder email will not be sent.

Parameters:

object $cart - Abandoned Cart object as saved in the DB.

int $cart_id - Abandoned Cart ID .

Example

function wcal_item_cart_total( $return_value, $cart_id) {
  return true;
}
add_filter( 'wcal_check_cart_total', 'wcal_item_cart_total', 10 , 2 );

The above will send the emails for all the carts irrespective of the cart total or product prices.


Hide/Edit the Product Image column in the reminder emails:

  1. wcal_reminder_email_img_header - Used to edit the column name for the Product Image column in the {{products.cart}} merge tag.

Parameters:

string $img_header - Column Name for Image.

Example:

add_filter( 'wcal_reminder_email_img_header', 'change_img_header', 10, 1 );
function change_img_header( $img_header ) {
$img_header = ''; // Will hide the column.
return $img_header;
}
  1. wcal_reminder_email_image_value - Used to edit the column value for the Product Image column in the {{products.cart}} merge tag. This filter will be run for each product row in the cart table displayed in the reminder emails.

Parameters:

string $image_col - <a> tag containing the Image URL. Links to the abandoned cart.

Example:

add_filter( 'wcal_reminder_email_image_value', 'change_img_value', 10, 1 );
function change_img_value( $img_col ) {
$img_col= ''; // Hide the column.
return $img_col;
}

When both the above filters return blank values, the Product Image column will be hidden in the reminder email.


Hide/Edit the Product Name column in the reminder emails:

  1. wcal_reminder_email_product_header - Used to edit the column name for the Product Name column in the {{products.cart}} merge tag.

Parameters:

string $product_name_header - Column Name for Product Name.

Example:

add_filter( 'wcal_reminder_email_product_header', 'change_name_header', 10, 1 );
function change_name_header( $name_header ) {
$name_header = 'Your selection'; // Will hide the column.
return $name_header;
}
  1. wcal_reminder_email_prod_value - Used to edit the column value for the Product Name column in the {{products.cart}} merge tag. This filter will be run for each product row in the cart table displayed in the reminder emails.

Parameters:

string $prod_col - <a> tag containing the Product Name. Links to the abandoned cart.

Example:

add_filter( 'wcal_reminder_email_prod_value', 'change_product_name', 10, 1 );
function change_product_name( $prod_col ) {
$prod_col= ''; // Hide the column.
return $prod_col;
}

When both the above filters return blank values, the Product Name column will be hidden in the reminder email.


Send custom cart link in reminder emails.

wcal_cart_link_email_before_encoding - Allows the site admin to redirect users to custom pages instead of the WC Cart page.

Parameters:

string $wc_cart - WC Cart page link.

int $cart_id - Abandoned Cart ID.

function update_cart_link( $wc_link, $cart_id ) {
     ... add checks as needed...
     $wc_link = [custom link of your choice];
     return $wc_link;
}
add_filter( 'wcal_cart_link_email_before_encoding', 'update_cart_link', 10, 2 );

Add custom style in {{products.cart}} merge tag table.

wcal_add_table_style_email - Allows the site admin to add custom style attributes to the table added in {{products.cart}} merge tag.

Parameters:

string $table_custom_style - style attributes as string.

function change_table_style( $table_custom_style ) {
     $table_custom_style .= 'background-color: #cde5ce;color: #000000'; // Note: always concat the style to ensure no previous data is lost.
     return $table_custom_style;
}
add_filter( 'wcal_add_table_style_email', 'change_table_style', 10, 1 );

Hide/Show Taxes in reminder emails.

wcal_show_taxes - Allows site admin to choose whether taxes should be displayed in reminder emails. Default: true

function hide_taxes( $display ) {
    $display = false;
    return $display;
}
add_filter( 'wcal_show_taxes', 'hide_taxes', 10, 1 );