Tổng quan về sự cố
Một lỗi nghiêm trọng xảy ra khi hủy đặt chỗ trong WooCommerce Bookings nếu tài nguyên đặt chỗ không được dịch:
Uncaught Error: Call to a member function get_resource_label() on null in .../wp-content/plugins/woocommerce-bookings/templates/emails/customer-booking-cancelled.php:49
Giải pháp tạm thời
Sự cố này đã được khắc phục trong WooCommerce Multilingual & Multicurrency 5.4.0. Việc cập nhật giải quyết vấn đề này trên trang web của bạn, vì vậy bạn chỉ cần giải pháp tạm thời này nếu chưa thể cập nhật.
Vui lòng đảm bảo bạn có bản sao lưu toàn bộ trang web của mình trước khi tiếp tục.
- Mở tệp …/wp-content/plugins/woocommerce-multilingual/compatibility/WcBookings/class-wcml-bookings.php.
- Tìm dòng 937.
- Thay thế:
if ( $booking_product_id ) { $trnsl_booking_product_id = apply_filters( 'translate_object_id', $booking_product_id, 'product', false, $language ); if ( is_null( $trnsl_booking_product_id ) ) { $trnsl_booking_product_id = ''; } } - Bằng:
if ( $booking_product_id ) { $trnsl_booking_product_id = apply_filters( 'translate_object_id', $booking_product_id, 'product', false, $language ); if ( is_null( $trnsl_booking_product_id ) ) { $trnsl_booking_product_id = $booking_product_id; } } - Sau đó, tìm dòng 956.
- Thay thế:
if ( is_null( $trnsl_booking_resource_id ) ) { $trnsl_booking_resource_id = ''; } - Bằng:
if ( is_null( $trnsl_booking_resource_id ) ) { $trnsl_booking_resource_id = $booking_resource_id; }