How to set different lower limit for different services?

I want to specify a different lower limit for different services for Appointments+ plugin. But the lower limit settings at the General Settings. Is there any way to do that?

  • Oguz

    Hey Edgardo ,

    Hope you're well.

    After you closed the live chat I found a way to do that with the help of SLS. So first you need to add these codes to your functions.php file at your theme files;

    add_action( 'appointments_init', function(){
    
        $app_options = get_option( 'appointments_options', array() );
        unset( $app_options['app_lower_limit'] );
        update_option( 'appointments_options', $app_options );
    
    }, 20 );
    
    add_filter( 'app-options-before_save', function( $options ){
    
        unset( $options['app_lower_limit'] );
        return $options;
    
    }, 20 );
    
    add_filter( 'appointments_default_options', function( $options ){
    
        if( ! is_admin() ){
            $appointments = appointments();
            $lower_limits_per_service = array(
                5 => 48,
                6 => 72
            );
    
            if( isset( $lower_limits_per_service[$appointments->service] ) ){
                $options['app_lower_limit'] = $lower_limits_per_service[$appointments->service];
            }
    
        }    
    
        return $options;
    }, 10 );

    And second you need to edit this part;

    $lower_limits_per_service = array(
                5 => 48,
                6 => 72
            );

    you can put your lower limits here, it works like service_id => hours. So in the example, the service which id is 5 has 48 hours. Once you put the code and make modifications then you should re-save plugin settings.

    I hope that helps!

    Cheers,
    Oguz

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.