This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('wp_enqueue_scripts', function() { | |
if (is_checkout()) { | |
wp_dequeue_script( 'pisol-mmq-amount' ); | |
} | |
}, PHP_INT_MAX); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('woocommerce_update_order_review_fragments',function($fragment){ | |
if(is_array($fragment)){ | |
$fragment['dont_reload_pickup_location'] = true; | |
} | |
return $fragment; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class pisol_custom_20250611{ | |
static $instance = null; | |
public static function get_instance() { | |
if (self::$instance === null) { | |
self::$instance = new self(); | |
} | |
return self::$instance; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('pisol_disable_order_limit_check', function($disable){ | |
if (is_user_logged_in()) { | |
$user = wp_get_current_user(); | |
if (in_array('administrator', $user->roles) || in_array('shop_manager', $user->roles)) { | |
$disable = true; | |
} | |
} | |
return $disable; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('doing_it_wrong_trigger_error', function($doing_it_wrong, $function_name) { | |
if ('_load_textdomain_just_in_time' === $function_name) { | |
return false; | |
} | |
return $doing_it_wrong; | |
}, 10, 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('woocommerce_package_rates', 'override_shipping_cost_to_zero_but_keep_label', PHP_INT_MAX, 2); | |
function override_shipping_cost_to_zero_but_keep_label($rates, $package) { | |
foreach ($rates as $rate_id => $rate) { | |
// Save original cost in the label for display | |
$original_cost = wc_price($rate->cost); | |
$rates[$rate_id]->label .= " (Normally $original_cost)"; | |
// Override actual cost to 0 | |
$rates[$rate_id]->cost = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('woocommerce_rest_prepare_shop_order_object', function ($response, $order, $request) { | |
if (isset($response->data['line_items']) && is_array($response->data['line_items'])) { | |
foreach ($response->data['line_items'] as $item_index => $item) { | |
if (isset($item['meta_data']) && is_array($item['meta_data'])) { | |
$filtered_meta = array_filter($item['meta_data'], function ($meta) { | |
$meta_keys_to_remove = ['pi_item_min_date', 'pi_item_max_date','pi_item_min_days','pi_item_max_days', '_pi_item_min_preparation_days', '_pi_item_max_preparation_days','_min_shipping_start_date', '_max_shipping_start_date','estimate_details']; | |
return !in_array($meta['key'], $meta_keys_to_remove); | |
}); | |
$response->data['line_items'][$item_index]['meta_data'] = array_values($filtered_meta); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wp_enqueue_scripts', function(){ | |
if(function_exists('is_checkout') && is_checkout()){ | |
wp_dequeue_script( 'wt-smart-coupon-for-woo' ); | |
wp_deregister_script( 'wt-smart-coupon-for-woo' ); | |
} | |
}, PHP_INT_MAX ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' ), |
NewerOlder