Make sure you have a child theme otherwise, this code will get deleted by WordPress when you will update the theme next time.
Hooks
↑ Back to topAdd a simple product to a subscription
↑ Back to topadd_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 topadd_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 topadd_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 topadd_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 topadd_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 topadd_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 topUsage: 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 topUsage: 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 topadd_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 topadd_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.
Back to main documentation.