Hi,
Well, your answer with inability to recreate the issue has motivated me to try. I have discovered the problem. Suppose user intentionally removed “Delivery Time Interval” (could happen for one reason or another). Then, this function in wfs-core-functions.php:
673:function wfs_get_service_time_interval( $service ) {
$service_interval = get_option( '_wfs_'.$service.'_time_interval', 0 );
$service_interval = intval( $service_interval ) * 60;
return $service_interval;
}
Doesn’t return the proper value – intval(null) * 60 = 0. This in turn causes range() in this function:
function wfs_get_store_timing( $service_type ) {
..
$pickup_interval = wfs_get_service_time_interval( 'pickup' );
$delivery_interval = wfs_get_service_time_interval( 'delivery' );
..
if ( $service_type == 'delivery' ) {
if( ( $close_time - $open_time ) > $delivery_interval )
$store_timings = range( $open_time, $close_time, $delivery_interval );
} else {
if( ( $close_time - $open_time ) > $pickup_interval )
$store_timings = range( $open_time, $close_time, $pickup_interval );
}
to turns into $store_timings = range(“11:00”, “12:00”, 0), and since step cannot be 0, we get the aforementioned error.
Suggested fix
Our proposal is to add simple check to wfs_get_service_time_interval() function, that would insure the value is never 0:
675: $service_interval = get_option( '_wfs_'.$service.'_time_interval', 0 );
if (!is_numeric($service_interval)) $service_interval = 30; // set it to 30
$service_interval = intval( $service_interval ) * 60;
We set it 30, because 0 would cause an error, and 1 would turn times into 1 minute-stepped intervals, instead of showing “Slots unavailable for selected Date!”, when such situation occurs.
Another way to fix it would be some sort of javascript/jQuery code that would check and/or adjust the value, if it goes blank.
Third way would be to check the value upon updating the database, but it seems like it requires substantial code modifications.
NOTE: Similar problem must probably take place when using pickup_interval instead of delivery, though I haven’t tested it.
Hope it helps!