No default values in woocoomerce_form_field() after 2.1? #4746

Closed
danielholm opened this Issue Feb 12, 2014 · 0 comments

1 participant

@danielholm

Hi all,

I have a lot of custom fields on my checkout page, that are vital for the clients webshop. If inputed before, the fields got the values from the profile, and are shown in the text fields by using "default" values.
After 2.1 upgrade they no longer are shown. The values are still there, I can print them and/or show them as "placeholder"'s, but the default values are empty.

Here is the code of one field:

    woocommerce_form_field( 'field_weight', array(
        'type'          => 'text',
        'class'         => array('custom-fieldset field-weight-class form-row-wide'),
        'label'         => __('Weight'),
        //'placeholder'   => $variable_weight, // works
        'default'       => $variable_weight, // does not work
        'required'      => "true",
    ),  $checkout->get_value( 'field_weight' ));

HTML output:

<p id="field_weight_field" class="form-row custom-fieldset field-weight-class form-row-wide validate-required">
    <label class="" for="field_weight"></label>
    <input id="field_weight" class="input-text " type="text" value="" placeholder="74" name="field_weight"></input>
</p>
@mikejolley mikejolley added a commit that closed this issue Feb 13, 2014
@mikejolley mikejolley The checkout's get_value method should return null if a value is not …
…yet set - this allows the 'default' in woocommerce_form_field to be used as a fallback Closes #4746
5b5183b
@mikejolley mikejolley added a commit that referenced this issue Feb 13, 2014
@mikejolley mikejolley The checkout's get_value method should return null if a value is not …
…yet set - this allows the 'default' in woocommerce_form_field to be used as a fallback Closes #4746
817ccb3
@coenjacobs coenjacobs added a commit that referenced this issue Feb 13, 2014
@coenjacobs coenjacobs Changelog bump for #4746 b6a6f4a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment