The following code has been supplied through the LearnDash WooCommerce integration plugin.
It creates a filter which makes it able to disable removing people from courses after the billing cycle is complete. I want to turn this on by default, so that users aren’t removed from their course anymore.
How can I apply this filter, without changing the plugin code?
/**
* Get setting if course access should be removed when user completeng subscription payment billing cycle
*
* @param object $subscription WC_Subscription object
* @return boolean
*/
public static function is_course_access_removed_on_subscription_billing_cycle_completion( $subscription )
{
return apply_filters( 'learndash_woocommerce_remove_course_access_on_subscription_billing_cycle_completion', false, $subscription );
}
2
Answers
You could use
Related/Source:
apply_filters( string $tag, mixed $value )
– Calls the callback functions that have been added to a filter hook.Example usage:
You can simply hook the WordPess
__return_false
function with this filter hook, to disable removing people from courses after the billing cycle is complete, this way:Code goes in functions.php file of your active child theme (active theme). It should work.