WPML
Status
Resolved
Reported for
WPML Multilingual & Multicurrency for WooCommerce 5.3.7
Resolved in
WooCommerce Multilingual & Multicurrency 5.4.0
Related plugin/theme
WooCommerce Bookings
Topic tags
Compatibility, WCML

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:
    		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:
    		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:
    			if ( is_null( $trnsl_booking_resource_id ) ) {
    				$trnsl_booking_resource_id = '';
    			}


  • With:
    			if ( is_null( $trnsl_booking_resource_id ) ) {
    				$trnsl_booking_resource_id = $booking_resource_id;
    			}

All known issues →