問題の概要
人数を指定する予約があり、その予約の人数が1人を超える場合、空き状況が正しく調整されず、利用可能なタイムスロットに誤った空き枠が表示されます。
回避策
この問題はWooCommerce Multilingual & Multicurrency 5.5.2で修正されました。 更新するとサイト上の問題は解決するため、この回避策が必要になるのは、まだ更新できない場合のみです。
開発チームがこの問題の修正に取り組んでいます。当面の間、WCML 5.5.0に戻すか、/wp-content/plugins/woocommerce-multilingual/compatibility/WcBookings/class-wcml-bookings.phpを開いてコードにパッチを適用できます。
コードを次のように調整します。変更前:
PHP
$booking_order_ids = []; array_walk( $existing_bookings, function ( WC_Booking $booking ) use ( &$booking_order_ids ) { /* @phpstan-ignore-next-line */ $booking_order_ids[] = $booking->get_order_id(); } ); $unique_ids = array_unique( $booking_order_ids ); // when blocked, we don't want each N-language variation to occupy one slot return count( $unique_ids );
PHP
$booking_person_counts_by_order = []; foreach ( $existing_bookings as $booking ) { /** @var WC_Booking $booking */ $order_id = $booking->get_order_id(); // Skip if already counted this order ID (to avoid double-counting translations) if ( isset( $booking_person_counts_by_order[ $order_id ] ) ) { continue; } // Get total persons (sum of all person types for this booking) $person_counts = array_sum( $booking->get_person_counts() ); // Store count by order ID $booking_person_counts_by_order[ $order_id ] = $person_counts; } // Return total number of persons across unique orders return array_sum( $booking_person_counts_by_order );