Can’t set the booking unit cost to 0
-
Hi,
Thank you for your plugin and your support. When you set the booking unit cost to 0 (for example when you want to make an offer and only use the base cost), the plugin returns an error due to the amount being divided by zero:
[11-Jan-2023 22:24:33 UTC] PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in /www/public/wp-content/plugins/mwb-bookings-for-woocommerce/common/class-mwb-bookings-for-woocommerce-common.php:266
I fixed by changing the code from
$unit = (int)($unit_price/$new_price);
to the following:
if($unit_price != 0) { $unit = (int)($unit_price/$new_price); } else { $unit = 0; }
However it would be great if you can fix this in the next version so that my change won’t be overwritten by updating the plugin.
Thank you
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Can’t set the booking unit cost to 0’ is closed to new replies.