Hi Marco,
The easiest way I though you could do that is unregistering the hook where we create the fields in the plugin, and then recreating it without the required
option, like that:
remove_action( 'woocommerce_before_order_notes', 'delivery_date_system_echo_fields', 5 );
function delivery_date_system_echo_non_required_fields( $checkout ) {
echo '<div class="delivery-options">';
woocommerce_form_field( 'delivery_date', array(
'type' => 'text',
'class' => array('form-row-wide'),
'id' => 'datepicker',
'required' => false,
'label' => __( 'Select one of the available delivery days', 'delivery-date-system' ),
'placeholder' => __( 'Open calendar', 'delivery-date-system' ),
'autocomplete' => 'off',
));
if ( ! empty( delivery_time_options() ) ) {
woocommerce_form_field( 'delivery_time', array(
'type' => 'select',
'class' => array('form-row-wide'),
'id' => 'delivery-time',
'required' => false,
'label' => __( 'Select a delivery time', 'delivery-date-system' ),
'options' => delivery_time_options()
));
}
echo '</div>';
}
add_action( 'woocommerce_before_order_notes', 'delivery_date_system_echo_non_required_fields', 5 );
I hope this can help you!
Best regards,
Allyson Souza
-
This reply was modified 5 years, 7 months ago by Allyson.
-
This reply was modified 5 years, 7 months ago by Allyson.