如果预订处于待处理、取消和未付款状态,则禁用 WCFM 中的预订状态更新选项

问题描述

我正在使用 wcfm 的 Hook 来禁用状态更新选项,但它不起作用。我想限制供应商更新状态。

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
 } } 

解决方法

有一个来自 wcfm 'wcfm_is_allow_booking_status_update' 的过滤器可以解决问题