I need to create a custom dropdown field but i need the values to be dynamic.
We need to be able to choose the delivery date but these have to automaticaly change every month for a maximum on 1 year
As soon as possible
Next month
June 2022
July 2022
....
April 2023
Etc
woocommerce_form_field( 'devlivery_date', array(
'type' => 'select',
'label' => $label,
'required' => true,
'options' => array(
'As soon as possible' => __( 'As soon as possible', 'wps' ),
'Next month' => __( 'Next month', 'wps' ),
'June 2022' => __( 'June 2022', 'wps' ),
'July 2022' => __( 'July 2022 ', 'wps' ),
'August 2022' => __( 'August 2022', 'wps' ),
'September 2022' => __( 'September 2022', 'wps' ),
'October 2022' => __( 'October 2022', 'wps' ),
'November 2022' => __( 'November 2022', 'wps' ),
'December 2022' => __( 'December 2022', 'wps' ),
'January 2023' => __( 'January 2023', 'wps' ),
'February 2023' => __( 'February 2023', 'wps' ),
'March 2023' => __( 'March 2023', 'wps' ),
'April 2023' => __( 'April 2023', 'wps' ),
)
),
Solution - 1
Can you please explain more?
Do you want the dropdown to remove months that are passed?
Please give us an example.
|