Shortcode for direct Service booking

Not sure if this is where this would go, but, I put together a quick shortcode to output direct booking links for all service providers.

Supply the shortcode with a service id# (Found in settings -> services tab) like:

[book_now service_id="1"]

And it will output direct links for the available (and unavailable) service providers for that service like:

<a class="button blue" href="{direct booking url}">Book at {service provider}?</a>

You'd probably want to change some of the wording, but I hope someone else finds this useful:

add_shortcode( 'book_now', 'sc_book_now' );
function sc_book_now( $atts, $content ) {
    global $post, $appointments;

        'service_id'            => false
    ), $atts));

    //TODO: Change this to your Online Booking Page
    $base_path = get_permalink(58);

    //Direct path to this service on the Booking Page
    $path = $base_path . '?app_service_id=' . $service_id;

    // Get all workers, and workers who can provide this service only
    $valid_workers = $appointments->get_workers_by_service($service_id);
    $workers = $appointments->get_workers();

    if ( $service_id && $workers) {
        if ( !$provider_id ) {
            $html = '';
            foreach ( $workers as $worker ) {
                if ( in_array( $worker, $valid_workers) ) {
                    // TODO: Change this to suit your needs!
                    // Worker is able to provide this service
                    $html .= '<a class="button blue" href="'.$path.'&app_provider_id='.$worker->ID.'">';
                    $html .= 'Book at ' . $appointments->get_worker_name( $worker->ID ) . '?';
                    $html .= '</a>';
                } else {
                    // TODO: Change this to suit your needs!
                    // Worker cannot provide this service
                    $html .= '<span class="button">';
                    $html .= 'Book at ' . $appointments->get_worker_name( $worker->ID ) . '?';
                    $html .= '</span>';
            if (!empty($html)) return $html;
    // TODO: Change this to suit your needs!
    // Couldn't find a proper link for this service (perhaps it doesn't exist?), default
    return '<a class="button blue" href="'.$base_path.'"> Book Online ? </a>';