How do I filter the enrollment shortcode AJAX return message?

Currently, the enrollment shortcode only has a parameter for the text to display on the enrollment button. However, there is a text string that is returned via AJAX when a student enrolls. There are two filters that are setup, one is for a successful return message and the other is an enrollment failure message.

Success message filter:

add_filter( 'wpcw_course_enrollment_success_message', function( $message, $course_id, $user_id ) {
	// Do something with the message. Replace it, append to it, etc...
    $message .= ' awesomeness';
    return $message;
}, 10, 3 );

Error message filter:

add_filter( 'wpcw_course_enrollment_error_message', function( $message, $course_id, $user_id ) {
    // Do something with the message. Replace it, append to it, etc...
	$message .= ' error awesomeness';
	return $message;
}, 10, 3 );

Still need help? Contact Us Contact Us