WPML
สถานะ
แก้ไขแล้ว
รายงานสำหรับ
WPML Multilingual & Multicurrency for WooCommerce 5.5.1
แก้ไขใน
WooCommerce Multilingual & Multicurrency 5.5.2
แท็กหัวข้อ
Bug, Compatibility, WCML

ภาพรวมของปัญหา

เมื่อคุณมีการจองที่ระบุจำนวนบุคคลและมีบุคคลมากกว่า 1 คนสำหรับการจองนั้น จำนวนที่ว่างจะไม่ได้รับการปรับอย่างถูกต้อง ส่งผลให้มีการแสดงที่ว่างผิดพลาดสำหรับช่วงเวลาที่สามารถจองได้

วิธีแก้ปัญหาชั่วคราว

นักพัฒนาของเรากำลังดำเนินการแก้ไขปัญหานี้ ในระหว่างนี้ คุณสามารถย้อนกลับไปใช้ WCML 5.5.0 หรือคุณสามารถแพตช์โค้ดได้โดยไปที่ /wp-content/plugins/woocommerce-multilingual/compatibility/WcBookings/class-wcml-bookings.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 );

เป็น:
			$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 );

ปัญหาที่ทราบแล้วทั้งหมด →