Skip to content

Instantly share code, notes, and snippets.

View rajeshsingh520's full-sized avatar

Rajesh rajeshsingh520

View GitHub Profile
if(!class_exists('pisol_custom_steve_sproston_20210521')){
class pisol_custom_steve_sproston_20210521{
public $pickup_only_products;
function __construct($product_ids){
// normalize to an array of unique integers
$this->pickup_only_products = array_unique(array_map('intval', (array) $product_ids));
add_filter('pisol_dtt_setting_filter_pi_type', array($this, 'type'));
}
@rajeshsingh520
rajeshsingh520 / gist:f1f036b32e85398e91f7a728d0685931
Created November 7, 2026 05:10
disable date and time plugin
class pi_custom_disable_date_time {
const META_KEY = 'pi_dtt_custom_disable_date_time';
private static $instance = null;
public static function get_instance() {
if ( null === self::$instance ) {
@rajeshsingh520
rajeshsingh520 / gist:a12c8542e35be62d3eaf36e3bf5c35d7
Last active November 3, 2026 10:15
different pickup days based on user role
/*
our all the setting has a filter applied on them like this pisol_dtt_setting_filter_{setting_key}
*/
add_filter('pisol_dtt_setting_filter_pi_pickup_days', function($days){
if (!is_user_logged_in()) {
return $days; // guests have no role, leave the default untouched
}
$user = wp_get_current_user();
if ( ! function_exists( 'pisol_strip_missing_amount_decimals_20260812' ) ) {
function pisol_strip_missing_amount_decimals_20260812( $html ) {
if ( empty( $html ) ) {
return $html;
}
$result = preg_replace(
'/(<span class="woocommerce-Price-amount amount"><bdi>.*?)\.\d{2}(<\/bdi><\/span>)/s',
'$1$2',
$html
);
add_action( 'init', function() {
global $wpdb;
$wpdb->query(
"
UPDATE {$wpdb->postmeta}
SET meta_value = ''
WHERE meta_key IN (
'out_of_stock_product_preparation_time',
@rajeshsingh520
rajeshsingh520 / gist:500624b945a2832e4c2c9c8da2ce0cf8
Last active July 31, 2026 09:04
preparation time to consider non working days
class pisol_custom_20260731{
static $instance = null;
public $format = 'Y/m/d';
public $today;
public $type;
public $holidays;
public $allowed_dates;
static function get_instance(){
if(self::$instance == null){
add_action( 'wp_footer', function() {
if ( ! is_checkout() || is_order_received_page() ) {
return;
}
?>
<script>
jQuery(function($) {
function toggleDeliveryDateBlock() {
@rajeshsingh520
rajeshsingh520 / gist:b57a2cedd287359f05d639266ac5742b
Created May 28, 2026 01:07
make Enquiry form date field to accept future dates only
add_filter('pisol_eqw_date_field_html', function ($html) {
$tomorrow = wp_date('Y-m-d', strtotime('+1 day'));
libxml_use_internal_errors(true);
$dom = new DOMDocument();
$dom->loadHTML(
mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'),
add_filter('woocommerce_paypal_payments_purchase_unit_from_wc_order', function ($purchase_unit, $order) {
if (!$purchase_unit instanceof \WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit || !$order instanceof \WC_Order) {
return $purchase_unit;
}
$actual_total = (float)$order->get_total();
$new_money = new \WooCommerce\PayPalCommerce\ApiClient\Entity\Money(
$actual_total,
$order->get_currency()
@rajeshsingh520
rajeshsingh520 / gist:1cefb9f38906a146c58745428e964563
Created May 15, 2026 10:05
move option fee selection to any place on checout page
class pisol_custom_clone_checkbox{
static $instance = null;
static $run = 0;
static function get_instance(){
if(is_null(self::$instance)){
self::$instance = new self();
}