Created
December 9, 2025 11:27
-
-
Save rajeshsingh520/521d2ab53205f2608e7fd0b3000a5ee3 to your computer and use it in GitHub Desktop.
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
| class pisol_custom_code_20251209{ | |
| public static $instance = null; | |
| public $saturday_next_day_cutoff_time = '12:30'; | |
| public static function get_instance() { | |
| if ( null === self::$instance ) { | |
| self::$instance = new self(); | |
| } | |
| return self::$instance; | |
| } | |
| private function __construct() { | |
| add_filter('pisol_dtt_setting_filter_pi_next_day_delivery_cutoff_time', [$this, 'saturday_next_day_cutoff_time']); | |
| add_filter('pisol_dtt_setting_filter_pi_order_preparation_days', [$this, 'saturday_preparation_days']); | |
| add_filter('pisol_dtt_setting_filter_pi_order_preparation_days_delivery', [$this, 'saturday_preparation_days']); | |
| } | |
| function saturday_next_day_cutoff_time($time) { | |
| // current_time('w') returns 0 (Sunday) through 6 (Saturday) in WP | |
| if ( (int) current_time( 'w' ) === 6 ) { | |
| return $this->saturday_next_day_cutoff_time; | |
| } | |
| return $time; | |
| } | |
| function saturday_preparation_days($days) { | |
| // current_time('w') returns 0 (Sunday) through 6 (Saturday) in WP | |
| $current_time_timestamp = current_time( 'timestamp' ); | |
| $cutoff_time = strtotime( date( 'Y-m-d', $current_time_timestamp ) . ' ' . $this->saturday_next_day_cutoff_time ); | |
| if ( (int) current_time( 'w' ) === 6 && $current_time_timestamp >= $cutoff_time ) { | |
| return 3; // Only Monday | |
| } | |
| return $days; | |
| } | |
| } | |
| pisol_custom_code_20251209::get_instance(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment