Last active
June 14, 2020 01:47
-
-
Save rajeshsingh520/9ae8cab04ffddfd449315ffb5ab2ba99 to your computer and use it in GitHub Desktop.
modify time slots for date or date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter('pisol_dtt_forced_time_slots', 'filter_time_slots',10, 4); | |
| function filter_time_slots($time_slots, $day_if_week, $date, $delviery_type){ | |
| /** | |
| you can make your custom logic to here to add new time slots, or remove existing, based on the day or specific date | |
| $time_slots = array( | |
| array('from' =>"12:00 AM", 'to' => "12:15 AM", 'order_limit' => ""), | |
| array('from' =>"12:30 AM", 'to' => "01:15 AM", 'order_limit' => ""), | |
| array('from' =>"02:00 AM", 'to' => "03:15 AM", 'order_limit' => ""), | |
| ); | |
| */ | |
| /** | |
| * this below code remove the first slot of array('from' =>"12:00 AM", 'to' => "12:15 AM", 'order_limit' => ""), | |
| * from the time slot for date 2020/06/30 | |
| * for other date this time slot will be available normally | |
| */ | |
| if($date == '2020/06/30'){ | |
| foreach($time_slots as $key => $slot){ | |
| if($slot['from'] == "12:00 AM"){ | |
| unset($time_slots[$key]); | |
| } | |
| } | |
| } | |
| return $time_slots; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment