Hooks
↑ Back to topAdd a simple product to a subscription
↑ Back to topDescription:
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 a variable product to a subscription
↑ Back to topDescription:
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 specified date
↑ Back to topDescription:
ssd_pause_subscription – fired after the subscription is paused.
Usage:
add_action( ssd_pause_subscription, function( $subscription_id, $pause_date ) { // custom code }, 10, 2 );
Attributes:
$subscription_id – Subscription id;
$pause_datet – The date until the subscription it’s paused.
Quantity update hook before calculating totals
↑ Back to topDescription:
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
↑ Back to topDescription:
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;
Filters
↑ Back to topFilter for changing the “Switch item” button text
↑ Back to topDescription:
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 'Change monthly hapé'; }
Attributes:
$text – The button text.
Filter “Add new product” query arguments
↑ Back to topDescription:
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
↑ Back to topDescription:
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
↑ Back to topDescription:
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.
Filter for changing the date format in the date picker used by the Change next payment date and Pause subscription functionalities
↑ Back to topDescription:
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
Supported date formats can be found here.
Filter for restricting the days available in the Change next payment date calendar
↑ Back to topDescription:
bos4w_restricted_weekdays – a filter that can restrict the available days in the Change next payment date calendar
Usage:
add_filter('bos4w_restricted_weekdays', 'my_custom_restricted_weekdays');
function my_custom_restricted_weekdays($restricted_weekdays) {
// Modify the $restricted_weekdays array as needed
$restricted_weekdays = array(0, 2, 3, 4, 5, 6); // Restrict All days except Monday
return $restricted_weekdays;
}
Attributes:
$restricted_weekdays – the days which will be restricted. These days will not be active.
Filter for restricting the days available in the Pause subscription calendar
↑ Back to topDescription:
bos4w_paused_restricted_weekdays – a filter that can restrict the available days in the Pause subscription calendar
Usage:
add_filter('bos4w_paused_restricted_weekdays', 'my_paused_restricted_weekdays');
function my_paused_restricted_weekdays($restricted_weekdays) {
// Modify the $restricted_weekdays array as needed
$restricted_weekdays = array(0, 2, 3, 4, 5, 6); // Restrict All days except Monday
return $restricted_weekdays;
}
Attributes:
$restricted_weekdays – the days which will be restricted. These days will not be active.
Filter for changing the Change next payment date button text
↑ Back to topDescription:
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 );
Back to main documentation.