Skip to content

Instantly share code, notes, and snippets.

View rajeshsingh520's full-sized avatar

Rajesh rajeshsingh520

View GitHub Profile
add_filter('pisol_dtt_date_sort', function($dates) {
// Define restricted product categories
$restricted_categories = array( 19, 22 );
// Check if products from restricted categories are in the cart
$cart = WC()->cart->get_cart();
$has_restricted_category = false;
if ( $cart ) {
foreach ( $cart as $cart_item ) {
@rajeshsingh520
rajeshsingh520 / gist:2ee4dfcc9a035f955f1a53f8561a7d2a
Created November 26, 2025 01:47
increase product preparation time based on the order count in the status processing for estimate date plugin
add_filter('pisol_edd_get_product_data', function($data, $object){
$orders = wc_get_orders([
'status' => 'processing',
'limit' => -1,
'return' => 'ids',
]);
$count = count($orders);
.pi-cod-deposit-container {
padding: 20px 20px 20px 10px !important;
}
.pi-checkmark {
display: inline-block !important;
}
.pi-cod-deposit-container input:checked+.pi-checkmark:after{
width: 24px;
@rajeshsingh520
rajeshsingh520 / gist:8db5aee68c811b04ebcb7ada68a1862d
Last active November 13, 2025 10:18
make shipping free when specific optional fee is selected
class PISOL_Zero_Shipping_On_Fee {
static $instance = null;
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
add_filter('woocommerce_order_item_get_method_title', function($title, $item){
$method_id = $item->get_method_id();
$instance_id = $item->get_instance_id();
if($method_id === 'pisol_extended_flat_shipping'){
$title = get_the_title($instance_id);
}
return $title;
}, PHP_INT_MAX, 2);
add_filter('pi_eqw_admin_email_id', function($email_id, $items, $email_obj){
if(isset($_POST['melyi-bemutatotermunk-van-kozelebb-onhoz']) &&
strpos($_POST['melyi-bemutatotermunk-van-kozelebb-onhoz'], 'Tatabánya') !== false ){
$email_id = 'email1@gmail.com';
}
return $email_id;
},10,3);
add_action( 'wp_enqueue_scripts', function () {
$js = "
jQuery(document).on('pi_add_to_enquiry_data', function(e, data){
if(jQuery('.wc-pao-addon-container').length == 0) return;
jQuery('.wc-pao-addon-container').each(function(){
var label = jQuery('.wc-pao-addon-name', this).text().trim();
var price = jQuery('input', this).val().trim();
if(price != ''){
data['variation_detail'][label] = price;
}
@rajeshsingh520
rajeshsingh520 / gist:4814ec13d942c7eb19ed54fd4f0ddf55
Created October 27, 2025 01:11
show sales popup only to logged in user
add_filter('pi_live_sales_notification_control_filter', function($show){
if( ! is_user_logged_in() ) {
return false;
}
return $show;
});
add_action( 'wp_enqueue_scripts', function(){
if(function_exists('is_checkout') && is_checkout()){
wp_dequeue_script( 'wc-opayopi-dropin' );
wp_deregister_script( 'wc-opayopi-dropin' );
}
}, PHP_INT_MAX );
@rajeshsingh520
rajeshsingh520 / gist:f00a217435b4f471a422dfee08e5d89f
Last active November 21, 2025 01:43
configure different preparation time by day of the week
if(!function_exists('custom_preparation_days_for_sat_sun')) {
add_filter('pisol_dtt_setting_filter_pi_order_preparation_days', 'custom_preparation_days_for_sat_sun', PHP_INT_MAX);
add_filter('pisol_dtt_setting_filter_pi_order_preparation_days_pickup', 'custom_preparation_days_for_sat_sun', PHP_INT_MAX);
add_filter('pisol_dtt_setting_filter_pi_order_preparation_days_delivery', 'custom_preparation_days_for_sat_sun', PHP_INT_MAX);
function custom_preparation_days_for_sat_sun($preparation_days) {
$day = (int) wp_date('w'); // 0 => sunday, 1 => monday
if($day == 0) return 2;