Skip to content

Instantly share code, notes, and snippets.

View rajeshsingh520's full-sized avatar

Rajesh rajeshsingh520

View GitHub Profile
add_action( 'wp_enqueue_scripts', function(){
if(current_user_can('manage_options') || current_user_can('shop_manager')) {
wp_dequeue_script( 'pi-woocommerce-order-date-time-and-type-pro-save-checkout' );
wp_deregister_script( 'pi-woocommerce-order-date-time-and-type-pro-save-checkout' );
}
}, PHP_INT_MAX);
@rajeshsingh520
rajeshsingh520 / gist:3da8c1486af826551d55ecaac64f234e
Created May 9, 2025 11:17
adding download invoice link in the google calendar order details page
add_filter('pi_dtt_google_calendar_event_desc', function($desc, $order){
$order_id = $order->get_id();
$download_url = add_query_arg(
array(
'action' => 'generate_wpo_wcpdf',
'document_type' => 'invoice',
'order_ids' => $order_id,
'_wpnonce' => wp_create_nonce( 'generate_wpo_wcpdf' ),
add_action('pisol_dtt_calendar_order_detail_header_buttons', function ($order_id){
if ( current_user_can('edit_shop_orders') ) {
$edit_order_url = admin_url('post.php?post=' . $order_id . '&action=edit');
echo '<button onclick="window.open(\'' . esc_url($edit_order_url) . '\', \'_blank\')" style="float:right; margin-left:5px;" class="admin-view-btn">View</button>';
}
}, 10, 1);
add_filter('pisol_cefw_cart_total', function($total, $cart, $fee_arg, $fees){
foreach($fee_arg as $fee_detail){
$total += $fee_detail['amount'];
}
return $total;
}, 10, 4);
add_filter('pisol_dtt_setting_filter_pi_dtt_co_time_placeholder', function($placeholder){
$placeholder = 'Select a time';
return $placeholder;
}, PHP_INT_MAX);
add_filter('pisol_dtt_setting_filter_pi_dtt_co_label_time', function($placeholder){
$placeholder = 'Time';
return $placeholder;
}, PHP_INT_MAX);
add_filter('pi_dtt_google_calendar_event_title', function($title, $order_id, $order) {
$customer_name = $order->get_billing_first_name();
$title = $customer_name .' - '.$title;
return $title;
}, 10, 3);
add_action('wp_enqueue_scripts', function(){
if(function_exists('is_checkout') && is_checkout()){
wp_enqueue_style( 'select2-pi', WC()->plugin_url() . '/assets/css/select2.css');
}
}, PHP_INT_MAX);
add_action('wp_enqueue_scripts', function(){
wp_dequeue_script('pisol-dtt-date-time-location-block');
wp_deregister_script('pisol-dtt-date-time-location-block');
}, PHP_INT_MAX);
add_filter('pisol_edd_load_simple_product_data', function($data){
$min = 100;
$max = 200;
$extra = 50;
if(!is_numeric($data['min_preparation_days'])) {
$data['min_preparation_days'] = $min;
}
add_filter('woocommerce_available_payment_gateways', function($gateways){
if(function_exists('WC') && isset(WC()->session) && is_object(WC()->session)){
WC()->session->set( 'stop_reload_do_ajax_again', null );
}
return $gateways;
}, PHP_INT_MAX);