Übersicht über das Problem
Beim Stornieren einer Buchung in WooCommerce Bookings tritt ein schwerwiegender Fehler auf, wenn die Ressource der Buchung nicht übersetzt ist:
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
Problemumgehung
Dieses Problem ist in WooCommerce Multilingual & Multicurrency 5.4.0 behoben. Ein Update behebt dies auf Ihrer Website, daher benötigen Sie diese Problemumgehung nur, wenn Sie noch nicht aktualisieren können.
Bitte stellen Sie sicher, dass Sie über ein vollständiges Backup Ihrer Website verfügen, bevor Sie fortfahren.
- Öffnen Sie die Datei …/wp-content/plugins/woocommerce-multilingual/compatibility/WcBookings/class-wcml-bookings.php.
- Suchen Sie nach Zeile 937.
- Ersetzen Sie:
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 = ''; } } - Durch:
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; } } - Suchen Sie dann nach Zeile 956.
- Ersetzen Sie:
if ( is_null( $trnsl_booking_resource_id ) ) { $trnsl_booking_resource_id = ''; } - Durch:
if ( is_null( $trnsl_booking_resource_id ) ) { $trnsl_booking_resource_id = $booking_resource_id; }