Hooks and filters

Hooks

Add subscription simple product

Description:

ssd_add_simple_product_before_calculate_totals – fired after a new simple product has been added to the subscription.

Usage:

add_action( 'ssd_add_simple_product_before_calculate_totals', function( $subscription, $product ) { // custom code }, 10, 2 );

Attributes:

$subscription – Subscription object data;

$item_id – The ID of the item with quantity updated;

$product – Product object data.

Add subscription variable product

Description:

ssd_add_variable_product_before_calculate_totals – fired after a new variable product has been added to the subscription.

Usage:

add_action( 'ssd_add_variable_product_before_calculate_totals', function( $subscription, $product, $variable_id ) { // custom code }, 10, 3 );

Attributes:

$subscription – Subscription object data;

$product – Product object data;

$variable_id – The product variable id.

Pause a subscription until a specific date

Description:

ssd_pause_subscription – fired after the subscription is paused until a specific date.

Usage:

add_action( ssd_pause_subscription, function( $subscription_id, $pause_date ) { // custom code }, 10, 2 );

Attributes:

$subscription_id – Subscription id;

$pause_date – The date until the subscription is paused.

Pause subscription notification

Description:

paused_subscription_notification – fired after the subscription is paused until a specific date.

Usage:

add_action( paused_subscription_notification, function( $subscription_id ) { // custom code }, 10, 2 );

Attributes:

$subscription_id – Subscription id.

Quantity update hook before calculating totals

Description:

ssd_quantity_update_before_calculate_totals – fired after the subscription item quantity gets updated.

Usage:

add_action( 'ssd_quantity_update_before_calculate_totals', function( $subscription, $item_id, $qty ) { // custom code }, 10, 3 );

Attributes:

$subscription – Subscription object data;

$item_id – The ID of the item with quantity updated;

$qty – The new quantity for the item.

Update subscription variable item before calculating totals

Description:

ssd_update_variable_item_before_calculate_totals – fired after the subscription variable item gets updated.

Usage:

add_action( 'ssd_update_variable_item_before_calculate_totals', function( $subscription, $item_id, $product, $variation_id ) { 
// custom code 
}, 10, 4 );

Attributes:

$subscription – Subscription object data;

$item_id – The ID of the item with quantity updated;

$product – Product object data;

$variation_id – Variation ID;

Display/Execute before the search form is displayed

Description:

ssd_before_add_to_cart_form_search – executes before the search form is displayed inside "Add new product".

Usage:

add_action( 'ssd_before_add_to_cart_form_search', function( $subscription_id ) {
	// custom code 
}, 10, 1 );

Attributes:

$subscription_id – Subscription ID.

Display/Execute before products are displayed 

Description:

ssd_before_add_to_cart_form – executes before the products are displayed inside the "Add new product" modal.

Usage:

add_action( 'ssd_before_add_to_cart_form', function( $subscription_id ) {
	// custom code 
}, 10, 1 );

Attributes:

$subscription_id – Subscription ID.

Display/Execute after the variable product is displayed in the "Add new product" modal

Description:

sdd_after_variable_product_form – executes after the products are displayed inside the "Add new product" modal.

Usage:

add_action( 'sdd_after_variable_product_form', function( $order_id, $subscription_id ) {
	// custom code 
}, 10, 2 );

Attributes:

$order_id – Order ID;

$subscription_id – Subscription ID.

Display/Execute after a simple product is displayed in the "Add new product" modal

Description:

sdd_after_simple_product_form – executes after the products are displayed inside the "Add new product" modal.

Usage:

add_action( 'sdd_after_simple_product_form', function( $order_id, $subscription_id ) {
	// custom code 
}, 10, 2 );

Attributes:

$order_id – Order ID;

$subscription_id – Subscription ID.

Trigger event when the subscription changes to active

Description:

active_subscription_notification – executes when the subscription is set to active, from pause status.

Usage:

add_action( 'active_subscription_notification', function( $order_id ) {
	// custom code 
}, 10, 1 );

Attributes:

$order_id – Order ID.

Trigger event when the subscription frequency is changed

Description:

sf_frequency_changed_email – executes when the subscription frequency is changed.

Usage:

add_action( 'sf_frequency_changed_email', function( $subscription_id, $frequency ) {
	// custom code 
}, 10, 2 );

Attributes:

$subscription_id – Subscription ID;

$frequency - Frequency string.

Trigger event when the subscription payment date has changed

Description:

change_payment_date_subscription_notification – executes when the subscription payment date has changed.

Usage:

add_action( 'change_payment_date_subscription_notification', function( $subscription_id ) {
	// custom code 
}, 10, 1 );

Attributes:

$subscription_id – Subscription ID.

Trigger event when the subscription payment date is changed

Description:

sf_change_next_payment_date_for_subscription – executes when the subscription payment date has changed.

Usage:

add_action( 'sf_change_next_payment_date_for_subscription', function( $subscription_id, $next_date ) {
	 // custom code 
}, 10, 2 );

Attributes:

$subscription_id – Subscription ID;

$next_date - Next string.

Filters

Filter for editing the text next to the price when a product has a Subscription frequency set

Description:

bos4w_subscription_text_display – allows editing of the “or subscribe and save up to” text.

Usage:

add_filter( 'bos4w_subscription_text_display', function ( $display_text ) {
   // custom code
   return $display_text;
}, 10, 1 );

Attributes:

$display_text – String to display

Filter for editing the text for the One-time purchase radio option

Description:

bos4w_one_time_buy_text – change the text for the One-time purchase radio option displayed on the product page

Usage:

add_filter( 'bos4w_one_time_buy_text', function ( $display_text ) {
   // custom code
   return $display_text;
}, 10, 1 );

Attributes:

$display_text – Radio option text.

Change the Interval and discount display for BOS products

Description:

ssd_subscription_plan_display – change the Interval and discount display options.

Usage:

add_filter( 'ssd_subscription_plan_display', function( $option_text, $period_interval, $discounted_price, $display_discount ) {
return $option_text;  
}, 10, 4);

Attributes:

$option_text – The discount select text;

$period_interval - Period interval;

$discounted_price - The discounted price;

$display_discount - The discount percentage.

Change the text and discount display in the radio button for the subscription purchase option

Description:

bos4w_and_save_up_to_text – change the text and discount for the radio button for the subscription purchase option displayed on the product page

Usage:

add_filter('bos4w_and_save_up_to_text', function($text,$discount) {
   $text = 'Custom text be added';
   return $text;
}, 10, 2);

Attributes:

$text – Radio option text.

$discount – highest discount set for the product.

Change the text for the frequency dropdown label

Description:

bos4w_dropdown_label_text – change the text for the frequency dropdown label displayed on the product page

Usage:

add_filter( 'bos4w_dropdown_label_text', function( $text ) {
   $text = 'Custom text';
   return $text;
}, 10, 1 );

Attributes:

$text – Dropdown label text.

Change/Update the BOS products query attributes

Description:

bos4w_product_query_args – contains the query attributes used in the wc_get_products() function.

Usage:

add_filter( 'bos4w_product_query_args', function( $prod_args ) { 
	// custom code  <br>
	return $prod_args; 
}, 10, 1 );

Attributes:

$prod_args – wc_get_products() query attributes.

Change the “Select options” button text

Description:

bos4w_add_to_cart_text – allow text change on the “Select options” button.

Usage:

add_filter( 'bos4w_add_to_cart_text', function( $button_text, $product ) {
  return 'Select options';  
}, 10, 2);

Attributes:

$button_text – The button text.

$product - Product object.

Filter for using the regular price instead of the sale price when the product is bought as a subscription

By default, the plugin will use the sale price if there is one set on the product back-end page. You can use this filter if you want the subscription purchases to use the regular price when a sale price is set.

Description:

bos_use_regular_price – allows the use of the product’s regular price instead of the sale price. The default is set to false.

Usage:

add_filter( 'bos_use_regular_price', function( $use_regular_price ) {
   // custom code
   return $use_regular_price;
}, 10, 1 );

Attributes:

$use_regular_price – bool true/false.

Change the “Switch item” button text

Description:

ssd_switch_item_text’ – allow text change on the “Switch item” button.

Usage:

add_filter( 'ssd_switch_item_text', 'custom_switch_item_text', 10, 1 ); 
function custom_switch_item_text( $text ) { 
return 'Switch item'; 
}

Attributes:

$text – The button text.

Edit the "Change quantity" button attributes

Description:

ssd_subscriptions_change_link – has the button HTML.

Usage:

add_filter( 'ssd_subscriptions_change_link', function( $switch_subscription_link, $item_id, $item, $subscription ) {  
// custom code   

return $switch_subscription_link; 
}, 10, 4 );

Attributes:

$switch_subscription_link  – The button HTML;

$item_id - Subscription Item ID;

$item - Subscription Item object;

$subscription - Subscription object.

Filter “Add new product” query arguments

Description:

ssd_product_query_args – allows query arguments to change. The filter allows you to change the WP_Query parameters used to get the products the user sees when adding a new item to a Subscription.

Usage:

add_filter( 'ssd_product_query_args', function( $args ) { 
// custom code
return $args; 
}, 10, 1 );

Attributes:

$args – wc_get_products arguments.

Filter “Add new product” product object

Description:

ssd_add_new_product_list – allows query arguments to change. The filter allows you to manipulate the object containing the list of products the user sees when adding a new item to a Subscription.

Usage:

add_filter( 'ssd_add_new_product_list', function( $products ) { 
// custom code  

return $products; 
}, 10, 1 );

Attributes:

$products – products object.

Filter for changing the calendar limit for the Change next payment date functionality

Description:

ssd_calendar_number_of_days – a filter that can be used for changing the calendar limit (in number of days) for the Change next payment date functionality

Usage:

add_filter( 'ssd_calendar_number_of_days', function ( $days ) {
   $days = 45;
   return $days;
}, 10, 1 );

Attributes:

$days – number of days for the calendar limit.

Change Paused date display format

Description:

ssd_paused_date_format – allows the user to change the date format display in front end.

Usage:

add_filter( 'ssd_paused_date_format', function( $date ) { 
// custom code 

return $date;
}, 10, 1 );

Attributes:

$date – The date - default format 'jS \of F Y';

Add/Update custom settings in the Self-serve Dash settings tab

Description:

settings_tabs_ssd_settings – contains all the settings inside SSD WooCommerce tab.

Usage:

add_filter( 'settings_tabs_ssd_settings', function( $settings ) { 
// custom code 

return $settings;
}, 10, 1 );

Attributes:

$settings – The admin settings tabs;

Edit the "Add new Product" button attributes

Description:

ssd_add_product_link – has the button HTML.

Usage:

add_filter( 'ssd_add_product_link', function( $add_product_link, $subscription ) { 
// custom code 

return $add_product_link;
}, 10, 2 );

Attributes:

$add_product_link – The button HTML;

$subscription - Subscription object.

Edit the "Change quantity" button attributes

Description:

ssd_subscriptions_quantity_link – has the button HTML.

Usage:

add_filter( 'ssd_subscriptions_quantity_link', function( $switch_link, $item_id, $item, $subscription ) { 
// custom code 

return $switch_link;
}, 10, 4 );

Attributes:

$switch_link  – The button HTML;

$item_id - Subscription Item ID;

$item - Subscription Item object;

$subscription - Subscription object.

Show/Hide product from the "Add new product" list

Description:

ssd_is_product_visible_to_add – Show or Hide product from the "Add new product" option.

Usage:

add_filter( 'ssd_is_product_visible_to_add', function( $is_visible, $product ) { 
// custom code 
return $is_visible;
}, 10, 2 );

Attributes:

$is_visible - Bool true/false;

$product - Product Object.

Change/Update Subscription Force admin settings

Description:

woocommerce_get_settings_subscription_force – contains the SF admin settings attributes.

Usage:

add_filter( 'woocommerce_get_settings_subscription_force', function( $settings ) {
	// custom code   
	return $settings; 
}, 10, 1 );

Attributes:

$settings – SF admin settings attributes.

Edit the "Change payment date" button attributes

Description:

sf_change_next_payment_date – has the button HTML.

Usage:

add_filter( 'sf_change_next_payment_date', function( $next_payment_date_link, $subscription ) {
	// custom code   
	return $next_payment_date_link; 
}, 10, 2 );

Attributes:

$next_payment_date_link – The button HTML;

$subscription - Subscription object.

Filter for changing the date format in the date picker used by the Change next payment date and Pause subscription functionalities

Description:

ssd_custom_date_format – a filter that can be used for changing the date format in the date picker used by the Change next payment date and Pause subscription functionalities

Usage:

add_filter( 'ssd_custom_date_format', function ( $date_format ) {
   return 'y-m-d';
}, 10, 1 );

Attributes:

$date_format – the date format

Filter for changing the Change next payment date button text

Description:

sf_payment_date_text – is a filter that will allow you to change the text for the Change next payment date button

Usage:

add_filter( 'sf_payment_date_text', function ( $text ) {
   return esc_html( 'Change your next payment' );
}, 10, 1 );
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.