0

I'm using plugin to set the earliest possible date for order delivery in woocommerce.

Piece of code below:

$current_time = current_time( 'timestamp' );
        if( $prdd_minimum_delivery_time != '' && $prdd_minimum_delivery_time != 0 ) {
            $advance_seconds = $prdd_minimum_delivery_time *60 *60;
            $cut_off_timestamp = $current_time + $advance_seconds;
            $cut_off_date = date( "d-m-Y", $cut_off_timestamp );
            $min_date = date( "j-n-Y", strtotime( $cut_off_date ) );
        } else {
            $min_date = date( "j-n-Y", $current_time );

Then piece of code below:

jQuery(document).ready(function() {
                    var formats = ["d.m.y", "d-m-yy","MM d, yy"];
                    var min_date = jQuery( "#prdd_lite_hidden_minimum_delivery_time" ).val();
                    var split_date = min_date.split( "-" );
                    var min_date_to_set = new Date ( split_date[1] + "/" + split_date[0] + "/" + split_date[2] );
                    var fourWorkingDays = new Date();
                    var adjustments = [2, 1, 1, 1, 1, 3, 3]; // Offsets by day of the week, sunday is first day here

I'm adding 1-2 day offset but my goal is to set it to rule "order to 3p.m. to get tommorrow" How can I modify that?

0

current_time() supports GMT as the second parameter.

See: https://codex.wordpress.org/current_time

If no second parameter is passed it should return the timezone set for your site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.