Table of Contents
Filters to modify the range of hours for shipping conditions
You should only paste the filters into the functions.php file in the theme folder.
Filter 1:
add_filter( 'flexible-shipping-pro/condition/time_of_the_day/interval', function( $interval ) {
return 15;
} );
Filter 2:
add_filter( 'flexible-shipping-pro/condition/time_of_the_day/options', 'fs_time_of_the_day_options' );
/**
* @param array $options
*
* @return array
*/
function fs_time_of_the_day_options( $options ) {
foreach (range(0, 23) as $hour) {
$hour = str_pad($hour, 2, '0', STR_PAD_LEFT);
foreach ([15, 30, 45] as $minute) {
$minute = str_pad($minute, 2, '0', STR_PAD_LEFT);
$options[] = [
'value' => $hour . ':' . $minute,
'label' => $hour . ':' . $minute,
];
}
}
return $options;
}
By adding these filters above, you can customize the time intervals and available time options in your Flexible Shipping PRO settings.