Skip to content

Instantly share code, notes, and snippets.

@rajeshsingh520
Created March 23, 2024 09:26
Show Gist options
  • Save rajeshsingh520/f18d0b819378aaacc059796ab340d57b to your computer and use it in GitHub Desktop.
Save rajeshsingh520/f18d0b819378aaacc059796ab340d57b to your computer and use it in GitHub Desktop.
add_action('wp_loaded', function(){
$dates = custom_get_dates_20240323(378);
error_log(print_r($dates, true));
});
function custom_get_dates_20240323($location_id){
if(isset(WC()->session) && is_object(WC()->session) && class_exists('pi_dtt_js')){
$old_location = WC()->session->get("pickup_location");
WC()->session->set("pickup_location", $location_id);
$dates = pi_dtt_js::allowedDates();
WC()->session->set("pickup_location", $old_location);
return $dates;
}
return [];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment