Skip to content

Instantly share code, notes, and snippets.

View rajeshsingh520's full-sized avatar

Rajesh rajeshsingh520

View GitHub Profile
@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;
}
add_filter(
'woocommerce_get_cart_item_from_session',
function ( $cart_item, $values ) {
if ( isset( $values['donation_amount'] ) ) {
$cart_item['donation_amount'] = $values['donation_amount'];
$cart_item['is_donation'] = true;
$cart_item['data']->set_price(
(float) $values['donation_amount']
@rajeshsingh520
rajeshsingh520 / gist:d3c957beebcdd056149f62050b39ca14
Created December 20, 2025 01:53
disable date and time options when cart only contain product from specific category
class pisol_marp_disable_dtt_plugin_options_for_category{
public $disable_for_cat = array(19, 23);
function __construct(){
add_filter('pisol_disable_dtt_completely', array($this, 'disableDateTimePlugin'));
}
function disableDateTimePlugin($value){
if(is_admin()) return;
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;
@rajeshsingh520
rajeshsingh520 / gist:2d05d47ab63f3dd2d3b8cba65df0f1a9
Created December 9, 2025 10:53
set 12:30 pm as Next day cutoff time for saturday and for remaining days it will remain normal as per your setting
add_filter('pisol_dtt_setting_filter_pi_next_day_delivery_cutoff_time', function($time) {
// current_time('w') returns 0 (Sunday) through 6 (Saturday) in WP
if ( (int) current_time( 'w' ) === 6 ) {
return '12:30';
}
return $time;
});
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);