1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Filter date field parameters
  1. Home
  2. Knowledge Base
  3. Date fields
  4. Filter date field parameters
  1. Home
  2. Knowledge Base
  3. Advanced
  4. Filter date field parameters

Filter date field parameters

You can filter the parameters for your date fields, provided you’re familiar with the jQuery Datepicker: https://jqueryui.com/datepicker/.

Here’s an example of how to prevent the user from picking a Sunday from the calendar:

<?php
/**
* Filter date parameters to disable Sundays
*/
function prefix_filter_date_field_params( $params, $item ) {
$params[] = 'beforeShowDay : function( date ) {
var day = date.getDay();
return [ ( day != 0 ), false ];
}';
return $params;
}
add_filter( 'pewc_filter_date_field_params', 'prefix_filter_date_field_params', 10, 2 );

You can find out how to add this snippet here.

Was this article helpful?

Need More Support?

If you can't find the answer that you're looking for, then please use the link below to raise a support ticket.
Contact Support

Related Articles