When cancelling a WooCommerce Booking related to a non-translated product with a non-translated reource, a fatal error is triggered in /wp-content/plugins/woocommerce-bookings/templates/emails/customer-booking-cancelled.php
After the booking is cancelled, the resource is missing in the booking which now displays "It appears the booking product associated with this booking has been removed." (the booking/resource still exist, but the reference in the booking is missing).
Une erreur de type E_ERROR a été causée dans la ligne 49 du fichier [...]/wp-content/plugins/woocommerce-bookings/templates/emails/customer-booking-cancelled.php. Message d'erreur : 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
Stack trace:
#0 [...]/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include()
#1 [...]/wp-content/plugins/woocommerce-bookings/includes/emails/class-wc-email-booking-cancelled.php(120): wc_get_template('emails/customer...', Array, 'woocommerce-boo...', '/www/formationc...')
#2 [...]/wp-content/plugins/woocommerce/includes/emails/class-wc-email.php(588): WC_Email_Booking_Cancelled->get_content_html()
#3 [...]/wp-content/plugins/woocommerce-bookings/includes/emails/class-wc-email-booking-cancelled.php(103): WC_Email->get_content()
#4 [...]/wp-content/plugins/woocommerce-multilingual/compatibility/WcBookings/Emails.php(182): WC_Email_Booking_Cancelled->trigger(64711)
#5 [internal function]: WCML\Compatibility\WcBookings\Emails->sendWithoutDuplicates(64711, 'WC_Email_Bookin...', 0)
#6 [...]/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(83): call_user_func_array(Array, Array)
#7 [internal function]: WPML\FP\{closure}('WC_Email_Bookin...', 0)
#8 [...]/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/collect/src/Illuminate/Support/Collection.php(603): array_map(Object(Closure), Array, Array)
#9 [...]/wp-content/plugins/woocommerce-multilingual/compatibility/WcBookings/Emails.php(163): WPML\Collect\Support\Collection->map(Object(Closure))
#10 [...]/wp-includes/class-wp-hook.php(326): WCML\Compatibility\WcBookings\Emails->WCML\Compatibility\WcBookings\{closure}(64711)
#11 [...]/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#12 [...]/wp-includes/plugin.php(565): WP_Hook->do_action(Array)
#13 [...]/wp-content/plugins/woocommerce/includes/class-wc-emails.php(170): do_action_ref_array('woocommerce_boo...', Array)
#14 [...]/wp-includes/class-wp-hook.php(324): WC_Emails::send_transactional_email(Array, Object(WC_Booking))
#15 [...]/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#16 [...]/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#17 [...]/wp-content/plugins/woocommerce-bookings/includes/data-objects/class-wc-booking.php(351): do_action('woocommerce_boo...', 64711, Object(WC_Booking))
#18 [...]/wp-content/plugins/woocommerce-bookings/includes/data-objects/class-wc-booking.php(252): WC_Booking->status_transitioned_handler('Pay\xC3\xA9e', 'Annul\xC3\xA9')
#19 [...]/wp-content/plugins/woocommerce-bookings/includes/data-objects/class-wc-booking.php(217): WC_Booking->status_transition()
#20 [...]/wp-content/plugins/woocommerce-bookings/includes/admin/class-wc-bookings-details-meta-box.php(671): WC_Booking->save()
#21 [...]/wp-includes/class-wp-hook.php(326): WC_Bookings_Details_Meta_Box->meta_box_save(64711, Object(WP_Post))
#22 [...]/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#23 [...]/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#24 [...]/wp-includes/post.php(4760): do_action('save_post', 64711, Object(WP_Post), true)
#25 [...]/wp-includes/post.php(4862): wp_insert_post(Array, false, true)
#26 [...]/wp-admin/includes/post.php(453): wp_update_post(Array)
#27 [...]/wp-admin/post.php(227): edit_post()
#28 {main}
thrown
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: America/Lima (GMT-05:00)
Hello,
I have tried to recreate the issue on the following test site, but can not confirm it yet: hidden link
Could you please try it for yourself?
It might be that this issue is further related to another plugin. Anyhow, the error points to the e-mail template used by WC Bookings and mentions also WCML and WPML.
As the issue does occur even on an original and untranslated product, we need to verify if the issue persists, once you disable WooCommerce Multilingual, WPML, and our addons.
If the issue is not occurring without our plugins, then we need to run further tests.
Do you maybe have a staging site ready for testing? If not, then I can offer to try to create a copy with "All In One WP Migration".
Best regards
Andreas
The topic ‘[Closed] Woocommerce Bookings Call to a member function get_resource_label() on null’ is closed to new replies.
Manage Cookie Consent
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.