Resolved
Reported for: WooCommerce Multilingual & Multicurrency 5.3.7
Resolved in: WooCommerce Multilingual & Multicurrency 5.4.0
Overview of the issue
A fatal error occurs when canceling a booking in WooCommerce Bookings if the booking resource is not translated:
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
Workaround
Please, make sure of having a full site backup of your site before proceeding.
- Open …/wp-content/plugins/woocommerce-multilingual/compatibility/WcBookings/class-wcml-bookings.php file.
- Look for line 937.
- Replace:
123456
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
=
''
;
}
}
- With:
123456
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
;
}
}
- Then, look for line 956.
- Replace:
123
if
(
is_null
(
$trnsl_booking_resource_id
) ) {
$trnsl_booking_resource_id
=
''
;
}
- With:
123
if
(
is_null
(
$trnsl_booking_resource_id
) ) {
$trnsl_booking_resource_id
=
$booking_resource_id
;
}