woocommerce / woocommerce-accommodation-bookings

An accommodations add-on for the WooCommerce Bookings extension.
91 stars 31 forks source link

Critical error on the Rates tab in the Product Editor #471

Open ariel-maidana opened 1 day ago

ariel-maidana commented 1 day ago

Trying to edit the rate on an accommodation product is throwing a critical error.

Steps to reproduce:

1) Create an Acommodation product. 2) Click on the Rates tab. 3) Try to edit the rates. 4) See issue:

Image

Error log:

[12-Nov-2024 20:47:09 UTC] PHP Fatal error:  Uncaught TypeError: Unsupported operand types: float - string in /srv/htdocs/wp-content/plugins/woocommerce-accommodation-bookings/includes/admin/views/html-accommodation-booking-rates-fields.php:117
Stack trace:
#0 /srv/htdocs/wp-content/plugins/woocommerce-accommodation-bookings/includes/admin/views/html-accommodation-booking-rates.php(46): include()
#1 /srv/htdocs/wp-content/plugins/woocommerce-accommodation-bookings/includes/admin/class-wc-accommodation-booking-admin-panels.php(95): include('/srv/htdocs/wp-...')
#2 /wordpress/core/6.6.2/wp-includes/class-wp-hook.php(324): WC_Accommodation_Booking_Admin_Panels->panels('')
#3 /wordpress/core/6.6.2/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#4 /wordpress/core/6.6.2/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#5 /wordpress/plugins/woocommerce/9.4.1/includes/admin/meta-boxes/views/html-product-data-panel.php(54): do_action('woocommerce_pro...')
#6 /wordpress/plugins/woocommerce/9.4.1/includes/admin/meta-boxes/class-wc-meta-box-product-data.php(33): include('/wordpress/plug...')
#7 /wordpress/core/6.6.2/wp-admin/includes/template.php(1456): WC_Meta_Box_Product_Data::output(Object(WP_Post), Array)
#8 /wordpress/core/6.6.2/wp-admin/edit-form-advanced.php(723): do_meta_boxes(Object(WP_Screen), 'normal', Object(WP_Post))
#9 /wordpress/core/6.6.2/wp-admin/post.php(206): require('/wordpress/core...')
#10 {main}
  thrown in /srv/htdocs/wp-content/plugins/woocommerce-accommodation-bookings/includes/admin/views/html-accommodation-booking-rates-fields.php on line 117

All plugins were inactive, except:

Theme: Storefront.

Context: 9001179-zd-a8c

ariel-maidana commented 1 day ago

I noticed that the product where the error is happening has a negative rate for a range. I asked the site owner to edit it to a non-negative number to see if that solves it for the affected product.