This thread is resolved. Here is a description of the problem and solution.
Problem: When cancelling a WooCommerce Booking in wp-admin, a fatal error occurs related to the cancellation email. This issue is due to a conflict between WooCommerce Multilingual & Multicurrency and WPML Multilingual CMS.
Solution: We recommend modifying the code in the WooCommerce Multilingual plugin to handle null values correctly. Specifically, in the file
If this solution does not resolve your issue or seems irrelevant due to updates or different circumstances, please check the related known issues and confirm that you have installed the latest versions of themes and plugins. If the problem persists, we highly recommend opening a new support ticket at WPML support forum.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Background of the issue:
When cancelling a WooCommerce Booking on wp-admin, a fatal error is generated related to the cancellation email.
WooCommerce support indicated that the issue is related to WPML. See the fatal error details and WooCommerce's feedback below.
WooCommerce Support Feedback:
"From the fatal errors and the PDF you shared, I see that the third-party plugins "̌WooCommerce Multilingual & Multicurrency" and "WPML Multilingual CMS" are conflicting with canceled booking emails.
You can also review this in the fatal errors stack trace:
#5 [internal function]: WCMLCompatibilityWcBookingsEmails->sendWithoutDuplicates()
#6 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-content/plugins/sitepress-multilingual05/08/2024, 12:41 R&B Distillers Limited Mail - Fwd: [Isle of Raasay Distillery] Your Site is Experiencing a Technical Issue
#10 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-includes/class-wp-hook.php(326):
WCMLCompatibilityWcBookingsEmails->WCMLCompatibilityWcBookings{closure}()
Screenshot: hidden link "
Symptoms:
A fatal error occurs when a user cancels a WooCommerce Booking.
A fatal error occurs when a user cancels a WooCommerce Booking. The error message is: Error Details
=============
An error of type E_ERROR was caused in line 49 of the file /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-content/plugins/woocommerce-bookings/templates/emails/customer-booking-cancelled.php. Error message: Uncaught Error: Call to a member function get_resource_label() on null in /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-content/plugins/woocommerce-bookings/templates/emails/customer-booking-cancelled.php:49
Stack trace:
#0 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include()
#1 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-content/plugins/woocommerce-bookings/includes/emails/class-wc-email-booking-cancelled.php(120): wc_get_template()
#2 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-content/plugins/woocommerce/includes/emails/class-wc-email.php(588): WC_Email_Booking_Cancelled->get_content_html()
#3 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-content/plugins/woocommerce-bookings/includes/emails/class-wc-email-booking-cancelled.php(103): WC_Email->get_content()
#4 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-content/plugins/woocommerce-multilingual/compatibility/WcBookings/Emails.php(182): WC_Email_Booking_Cancelled->trigger()
#5 [internal function]: WCMLCompatibilityWcBookingsEmails->sendWithoutDuplicates()
#6 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(83): call_user_func_array()
#7 [internal function]: WPMLFP{closure}()
#8 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/collect/src/Illuminate/Support/Collection.php(603): array_map()
#9 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-content/plugins/woocommerce-multilingual/compatibility/WcBookings/Emails.php(163): WPMLCollectSupportCollection->map()
#10 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-includes/class-wp-hook.php(326): WCMLCompatibilityWcBookingsEmails->WCMLCompatibilityWcBookings{closure}()
#11 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#12 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-includes/plugin.php(565): WP_Hook->do_action()
#13 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-content/plugins/woocommerce/includes/class-wc-emails.php(172): do_action_ref_array()
#14 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-includes/class-wp-hook.php(324): WC_Emails::send_transactional_email()
#15 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#16 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#17 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-content/plugins/woocommerce-bookings/includes/data-objects/class-wc-booking.php(365): do_action()
#18 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-content/plugins/woocommerce-bookings/includes/data-objects/class-wc-booking.php(261): WC_Booking->status_transitioned_handler()
#19 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-content/plugins/woocommerce-bookings/includes/data-objects/class-wc-booking.php(226): WC_Booking->status_transition()
#20 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-content/plugins/woocommerce-bookings/includes/admin/class-wc-bookings-details-meta-box.php(682): WC_Booking->save()
#21 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-includes/class-wp-hook.php(326): WC_Bookings_Details_Meta_Box->meta_box_save()
#22 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#23 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#24 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-includes/post.php(4891): do_action()
#25 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-includes/post.php(4993): wp_insert_post()
#26 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-admin/includes/post.php(453): wp_update_post()
#27 /mnt/data/home/585904.cloudwaysapps.com/sfvbzahsjd/public_html/wp-admin/post.php(227): edit_post()
#28 {main}
thrown
Questions:
How can I resolve the fatal error when cancelling a WooCommerce Booking?
Is there a known conflict between WPML and WooCommerce Booking cancellation emails?
I have tried to reproduce the same issue on new test site, but I do not get an error. I have setup a new website with WC Bookings and created a new bookable product. Made an order from frontend in the default language, and then tried to cancel the order from back, it works fine and no error.
Can you please check: hidden link
seems some specific steps or settings are needed for the issue to happen.
I'm not clear why but your test site is not setting the booked products to Paid status, they seem to stay at Unpaid even with the order is set to processing.
The bookings should be set to paid, until then they aren't confirmed bookings.
The above is something to do with the test site's payment method I would guess.
I suspect a booking set to Unpaid won't trigger the cancellation email, hence the lack of error.
If we manually set the booking to paid, then cancel it the error is reproduced: hidden link
thanks, that is correct, but I also see you have added resources and products but have not translated them.
I have translated both and seems the fatal error is not there, but seems there is another bug, when making an order you are not redirected to the thank you page, even if the order is created in the back.
Can you test this on the test site and your website and let me know how it goes?
Note is needed to translate resources as explained in the docs:
I have both Booking and booking resources set to Not Translatable.
Surely your plugin should be able to cope with this scenario without causing a fatal error on the site?!
To be blunt I've spent enough time on this - in my view this is a bug that can be reproduced on a fresh install and should be investigated and addressed.
the issue is escalated to our developers, and in the meantime, you can use the next workaround:
in wp-content/plugins/woocommerce-multilingual/compatibility/WcBookings/class-wcml-bookings.php \WCML_Bookings::get_translated_booking_resource_id around line 948
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.