Skip to content

Instantly share code, notes, and snippets.

@pramodjodhani
Created April 22, 2026 07:16
Show Gist options
  • Select an option

  • Save pramodjodhani/582e190cf5ade1fc9c3974c0435b64fe to your computer and use it in GitHub Desktop.

Select an option

Save pramodjodhani/582e190cf5ade1fc9c3974c0435b64fe to your computer and use it in GitHub Desktop.
Disable Orderable ASAP settings for Local Pickup shipping method.
<?php
/**
* Disable Orderable ASAP settings for Local Pickup shipping method.
*/
add_action( 'orderable_location_object_init', function( $location ) {
// Only run on the frontend/checkout and ensure WooCommerce is active.
if ( is_admin() || ! function_exists( 'WC' ) || ! WC()->session ) {
return;
}
if ( ! class_exists( 'Orderable_Services' ) ) {
return;
}
// Get the currently selected service type (pickup or delivery).
$service_type = Orderable_Services::get_selected_service( false );
/**
* If the service is 'pickup', we disable the ASAP settings.
* Orderable maps 'local_pickup' to the 'pickup' service type.
*/
if ( 'pickup' === $service_type ) {
// '0' disables the setting, '1' enables it.
$location->location_data['asap_date'] = '0';
$location->location_data['asap_time'] = '0';
}
}, 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment