Support » Plugin: WooCommerce » Problem on adding class to input fields

  • Hey there, im following this tutorial to add class to input fields

    Here is my code:

    add_filter( 'woocommerce_billing_fields', 'wc_npr_filter_phone', 10, 1 );
    function wc_npr_filter_phone( $address_fields ) {
       $address_fields['billing_phone']['class'] = array('input-text input-block-level');
       return $address_fields;

    its actually adding the class i want, but wrong place, it`s adding to the <strong><p></strong> wich wraps the input field, and not into the <input> itself!

    <p class="form-row input-text input-block-level validate-required" id="billing_phone_field">
       <label for="billing_phone" class="">Telefone <abbr class="required" title="obrigatório">*</abbr></label>
       <input type="text" class="input-text" name="billing_phone" id="billing_phone" placeholder="Telefone" value="4891675952">

    what could it be?

  • The topic ‘Problem on adding class to input fields’ is closed to new replies.