How do you take block bookings in Appointments+ ?

How do we make block bookings in Appointments+? For example, we have services in 15, 30 and 60 minute time slots, but often need to block out a 4-6 hour slots for a longer booking.

  • Adam Czajczyk
    • Support Gorilla

    Hello Tom

    I hope you’re well today and thank you for your question!

    Appointments can only be booked according to existing services – so only in “blocks” of the duration as defined for services. If there are e.g. 15 and 30 minutes booking slots, the only way to book 2 hours would be too book either 4 x 30 minutes appointment or 8 x 15 minutes appointment.

    A workaround would be to create additional services of a longer duration and if you don’t want your users/customers to be able to book them and instead want to be able to book them only from back-end, you can hide them from being displayed on front-end booking calendar.

    By default on the “make an appointment” page on front-end there are these shortcodes used:

    [app_service_providers]

    [app_monthly_schedule]

    Both of them can take “service” attribute letting you display only service providers and booking calendar for specified service(s). This way you could hide those longer appointments from front-end and still be able to book them manually (thus “block” them) via back-end.

    For example

    [app_monthly-schedule service=”3″]

    would show calendar for only service of ID 3 so other would be invisible.

    Would that do the trick for you?

    If I’m missing the point or this wouldn’t be a solution for you, let me know please and I”ll check what else could be done about this.

    Kind regards,

    Adam

  • Tom
    • New Recruit

    Hi Adam,

    Thanks for the quick response – although not ideal, this would probably get the job done. It doesn’t seem to be working though, as all services are still displayed on the frontend. Here’s the code:

    <table>

    <tbody>

    <tr>

    <td>[app_services]</td>

    </tr>

    <tr class=”booking-month”>

    <td colspan=”2″>[app_monthly_schedule service=”1,2,3,8,9,10,11,12,13,14,15,16,17″]</td>

    </tr>

    <tr>

    <td colspan=”2″>[app_pagination month=”1″]</td>

    </tr>

    <tr class=”confirmation”>

    <td colspan=”2″>[app_confirmation]</td>

    </tr>

    </tbody>

    </table>

    Are we able to use an array of IDs like that? Are there any other issues here? Could we be doing this better somehow?

  • Tom
    • New Recruit

    Edit: We are now using the below, as it seems the newer shortcodes are cleaner:

    [app_monthly_schedule require_service=”1″ service=”1,2,3,8,9,10,11,12,13,14,15,16,17″ required_service_message=”Please, select an activity.”]

    [app_confirmation]

    From reading the documentation it looks like we may not be able to use multiple IDs – any other ideas? https://premium.wpmudev.org/docs/wpmu-dev-plugins/appointments-shortcode-reference/

  • Adam Czajczyk
    • Support Gorilla

    Hello Tom

    Thanks for your response!

    You’re right actually, there can only be one ID used at the time. That’s my mistake and I’m sorry for it – I was aware of that but somehow missed the “connection” to the case.

    However, there is a solution for this and it’s not too complex fortunately :slight_smile: First, you’d want to remove the “service” attribute from the shortcode so all the services were included. Then use this code:

    <?php

    // use as mu-plugin

    function app_exclude_selected_services_services_shortcode($services) {

    $selected_services = array('2' , '4' ); // list your services to be excluded ID's here as array values

    $new_services = array();
    foreach ( $services as $service ) {
    if ( in_array( $service->ID, $selected_services ) ) {
    continue;
    }
    array_push( $new_services, $service);
    }

    return $new_services;

    }
    add_filter('app_services', 'app_exclude_selected_services_services_shortcode', 10, 1);

    You will want to adjust this line:

    $selected_services = array( '2 ', '4' );

    2 and 4 are IDs of services that you want to exclude – those that you wish to hide – so you’ll want to replace them with your own services’ IDs; you can add as many as you need there.

    To apply the code to the site:

    – create an empty file with a .php extension (e.g. “appointments-exclude-services.php”:wink:

    – copy and past code into the file using some “clean text” editor (such as Notepad++, Sublime or similar or any coding editor/IDE or editor in cPanel File Manager)

    – put the file into the “/wp-content/mu-plugins” folder of your site’s WordPress install; if there’s no “mu-plugins” folder directly in “wp-content” folder, just create an empty one first.

    What the code does is that it just “re-writes” the list of services to be displayed (before they are displayed) skipping the ones that you define.

    Best regards,

    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.