wordpresswoocommercehook-woocommercewoocommerce-bookings

Disable Booking status update option in WCFM if booking is pending, Cancelled & unpaid


I'm using Hook from wcfm to disable the status update option but it's not working. I want to restrict the vendors from updating status.

add_action( 'wcfm_booking_overview_block', 'disable_cancelled_booking', 20, 2 ); 
function disable_cancelled_booking($booking, $product) { 
global $current_user; //Get User Role 
$user_roles = $current_user->roles; 
$user_role = array_shift($user_roles);

//Checking Status of booking & role of the current user based on that the status update field will be hidden 
if(($booking->status == "cancelled" || $booking->status == "unpaid"|| $booking->status == "pending-confirmation") && $user_role =="wcfm_vendor") { 
//Disable option
 } } 

Solution

  • There is a filter from wcfm 'wcfm_is_allow_booking_status_update'which does the trick