Add option to allow rescheduling for all staff

Issue #991 new
Valentina R created an issue

When a product has multiple staff and one tries to reschedule the appointment, only the booked staff is given as an option. One should be allowed to choose if they wish to allow rescheduling to all staff assigned to the product. Even using a filter would be good enough.

Requested here when using staff as a location.

Comments (3)

  1. Valentina R reporter

    Temp solution ONLY for the CUSTOMER SELECTED option and without the “No preferences” option. It requires modifying a core plugin file + code snippet.

    // Display all staff added to product to show in reschedule form
    // You need to modify a core plugin file (will be overriden on next plugin update):
    // file woocommerce-appointments\includes\class-wc-appointment-order-manager.php
    // commment out lines 353 - 357 as seen here:
    /*  if ( $appointment->get_staff_ids() ) {
                #$product->set_staff_assignment( 'automatic' );
                $product->set_staff_ids( $appointment->get_staff_ids() );
                $product->set_staff_nopref( false );
            }*/
    
    // Save selected staff to appointment
    add_action('woocommerce_appointments_before_rescheduled_appointment', function( $appointment, $appointment_data ){
    
      // Check if the appointment has staff selected
        if ( isset( $appointment_data['_staff_id'] ) ) {
            $appointment->set_staff_ids( $appointment_data['_staff_id'] ); // ID of the staff
        $appointment->save();
        }
    
    }, 99, 2);
    

  2. Log in to comment