Skip to content

Instantly share code, notes, and snippets.

View rajeshsingh520's full-sized avatar

Rajesh rajeshsingh520

View GitHub Profile
@rajeshsingh520
rajeshsingh520 / gist:adf85b6fbbb63551e5b581998cab26f7
Last active June 25, 2026 10:51
charge fees based on selected delivery time
if(defined('PI_CEFW_SELECTION_RULE_SLUG')){
class Pi_cefw_selection_rule_selected_time_between_time{
public $slug;
public $condition;
function __construct($slug){
$this->slug = $slug;
$this->condition = 'selected_time_between_time';
/* this adds the condition in set of rules dropdown */
add_filter('before_send_order_to_iconnect', function ($baseOrder) {
$order = wc_get_order($baseOrder->order_id);
if (!$order) return $baseOrder;
$piDate = $order->get_meta('pi_system_delivery_date', true);
$piTime = $order->get_meta('pi_delivery_time', true);
if(empty($piTime)){
$piTime = '21:00';
}
add_filter('before_send_order_to_iconnect', function ($baseOrder) {
$order = wc_get_order($baseOrder->order_id);
if (!$order) return $baseOrder;
$piDate = $order->get_meta('pi_delivery_date', true);
$piTime = $order->get_meta('pi_delivery_time', true);
$ts = '';
if (!empty($piDate) && !empty($piTime)) {
$timePart = trim(explode('-', (string) $piTime)[0]); // "10:00 - 10:30" -> "10:00"
add_filter('pisol_dtt_ics_default_start_time', function($time){
return '09:00';
}, PHP_INT_MAX);
add_filter('pisol_dtt_ics_default_end_time', function($time){
return '21:00';
}, PHP_INT_MAX);
class TwentyTwenty_Custom_Scripts {
private static $instance = null;
public $hide_field_name = 'delivery-address';
public static function get_instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
add_filter('pisol_dtt_setting_filter_pi_type', function($type){
$todays_date = current_time('Y/m/d');
$disable_delivery_date = '2026/02/16';
$cutoff_time = '13:00';
$current_time = current_time('H:i');
if($todays_date === $disable_delivery_date && strtotime($current_time) < strtotime($cutoff_time)){
return 'Pickup';
}
return $type;
}, PHP_INT_MAX);
class pisol_custom_code_20260119{
static $instance = null;
static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
class pisol_marp_disable_dtt_plugin_options_for_category{
public $disable_for_cat = array(85,76);
function __construct(){
add_filter('pisol_disable_dtt_completely', array($this, 'disableDateTimePlugin'));
}
function disableDateTimePlugin($value){
if(is_admin()) return $value;
class TwentyTwenty_Enquiry_Handler {
private static $instance;
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
@rajeshsingh520
rajeshsingh520 / gist:6b0c1a72c1d6e88c29aecd25b4c95790
Created December 24, 2025 04:25
store credit with germanize
class pisol_acblw_germanize{
static $instance = null;
public static function get_instance(){
if(self::$instance == null){
self::$instance = new self();
}
return self::$instance;
}