跳过导航

Open

Reported for: WooCommerce Multilingual & Multicurrency 5.3.7

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;
    			}
    

留下回复

紧扣主题并尊重他人。如果您需要帮助解决与本帖无关的问题,请使用我们的 Support Forum 开始聊天或提交票据。

您可以使用这些标签:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>