Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Eini0815

    (@eini0815)

    Hi,

    just for information – solved it with a trick:

    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
    function custom_override_checkout_fields( $fields ) {
     $fields['billing']['billing_postcode'] = array(              //replace billing_postcode with your custom field name or something ;)
             'label' => __('Postcode', 'woocommerce'),              //replace Postcode with the field label
              'placeholder' => _x('Postcode', 'placeholder', 'woocommerce'),         //replace Postcode with your custom default value
              'required' => false,
              'clear' => false,
              'type' => 'select',
              'class' => array('form-row-wide'),
              'options' => array(
                       'option_a' => __('123456', 'woocommerce' ),
              )
     );
    return $fields;
    }
    Thread Starter Eini0815

    (@eini0815)

    With this you only get a placeholder – not a prefilled field (so a customer has to re enter the value).

    The placeholder value also works – so I have the correct fields and syntax – but not the default value.

Viewing 2 replies - 1 through 2 (of 2 total)