Restrict the allowed dates for the DatePicker Field in WooCommerce Checkout Manager

You can limit the allowed dates for the DatePicker Field Type so that only specific dates are accepted (e.g. today’s date onward, or up to 3 months from today).

Add the following PHP snippets to your current WordPress Theme’s functions.php file to limit the DatePicker Field to only accept dates from today’s date forward. You can apply other DatePicker rules (jQuery UI) using the below method.

View Code

 

15 thoughts on “Restrict the allowed dates for the DatePicker Field in WooCommerce Checkout Manager

  1. Where in the functions.php can I add this? Just anywhere or do I need to place it somewhere specific?

    • Hi cynthia, anywhere within your Theme’s functions.php file will work. If your functions.php already contains < ?php and ?> start and ending lines then don’t include them. I hope this helps 🙂

  2. When I add this to the child theme function.php, the site breaks. I need to make the date-picker one day ahead. I already have a function in the file, so I stripped off the beginning . Is that wrong?

    • Hi Mary, if you’re pasting the above PHP snippet into your Theme’s functions.php file please remove the opening and ending lines:

      < ?php ... ?>

      • Thx – I actually worked this out and submitted a request to limit timepicker to open hrs of the store – started another topic for that – hope you can help with that

        • Nice! I’m up against the wall preparing for WooCommerce 3.0 (including a WCM Plugin update) but once that all settles down after April 4 I’ll be back on the w.org forums helping out 🙂

          • Ooo – My target release date for this website is April 1 – can you please direct me to somebody who can solve this – I don’t want to miss my deadline. thanks

              • i realize that – the problem is I have bought lots of paid plugins that are a disappointment. i know you don’t have time – but hopefully your link will provide some insight. I don’t think my problem is particularly complicated – I just need how to exactly code the fix. too bad – I need to look for a plugin that can solve my problem before April 1. Maybe I won’t – and then I get a bad rep and so do you. Thanks anyway.

                • Hi Mary, you may need to purchase a Plugin then that matches your requirements (and that is also actively supported and provides customisations if required), I wish you luck but do ping your topic as it’s pretty active during the week 🙂

          • Just add this to your functions.php to alter the minutes interval and limit selectable hours in the day

            /* WC Checkout manager only allow certain times with 30 minute intervals*/
            add_filter( ‘wooccm_timepicker_jquery_args’, ‘custom_wooccm_js_timepicker_billing_args’,10,2 );
            function custom_wooccm_js_timepicker_billing_args( $args, $btn) {

            $args .= ‘
            ,
            minutes: {interval: 30, manual: [30] },
            showPeriod: true,
            hours: { starts: 08, ends: \’17\’ }
            ‘;

            return $args;

            }

Leave a Comment

Before you comment - Do you have a support request? If so, this is not the right place to post it. Please submit support requests for Premium Plugins on the Support page and in the community Support Forums for free Plugins.

Your email address will not be published. Required fields are marked *