1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Add select fields for month and year to date field
  1. Home
  2. Knowledge Base
  3. Date fields
  4. Add select fields for month and year to date field

Add select fields for month and year to date field

You can make it easier for users to select a month and year by enabling select fields for each parameter.

Just add the following snippet:

<?php
/**
* Add select fields for month and year to date field
*/
function prefix_date_field_params_change_month( $params, $item ) {
$params[] = "changeMonth: true";
$params[] = "changeYear: true";
$params[] = "yearRange: '1900:2030'";
return $params;
}
add_filter( 'pewc_filter_date_field_params', 'prefix_date_field_params_change_month', 10, 2 );

Here’s how to add a snippet.

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