Title: Parse error: syntax error, unexpected &#039;{&#039; when editing function.php
Last modified: August 31, 2016

---

# Parse error: syntax error, unexpected '{' when editing function.php

 *  [moh19814](https://wordpress.org/support/users/moh19814/)
 * (@moh19814)
 * [10 years ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-when-editing-functionphp/)
 * I am trying to add some extra fields to the registration form in Woocommerce 
   by following the post on
    -  [http://www.themelocation.com/how-to-add-custom-fields-to-user-registration-form-in-woocommerce/](http://www.themelocation.com/how-to-add-custom-fields-to-user-registration-form-in-woocommerce/)
 * , but I am getting the following error:
    ” Parse error: syntax error, unexpected‘{‘
   in C:\Apache24\htdocs\wordpress\wp-content\themes\flatsome\functions.php on line
   14″
 * Here is the code:
 *     ```
       <?php
       /**
        * Flatsome functions and definitions
        *
        * @package flatsome
        */
   
       require get_template_directory() . '/inc/init.php';
   
       /**
        * Note: Do not add any custom code here. Please use a child theme so that your customizations aren't lost during updates.
        * http://codex.wordpress.org/Child_Themes
        */
       function wooc_extra_register_fields(){
       ?>
   
       <p class="form-row form-row-first">
       <label for="reg_billing_first_name"><?php _e( 'First name', 'woocommerce' ); ?><span class="required">*</span></label>
       <input type="text" class="input-text" name="billing_first_name" id="reg_billing_first_name" value="<?php if ( ! empty( $_POST['billing_first_name'] ) ) esc_attr_e( $_POST['billing_first_name'] ); ?>" />
       </p>
   
       <p class="form-row form-row-last">
       <label for="reg_billing_last_name"><?php _e( 'Last name', 'woocommerce' ); ?><span class="required">*</span></label>
       <input type="text" class="input-text" name="billing_last_name" id="reg_billing_last_name" value="<?php if ( ! empty( $_POST['billing_last_name'] ) ) esc_attr_e( $_POST['billing_last_name'] ); ?>" />
       </p>
   
       <div class="clear"></div>
   
       <p class="form-row form-row-wide">
       <label for="reg_billing_phone"><?php _e( 'Phone', 'woocommerce' ); ?><span class="required">*</span></label>
       <input type="text" class="input-text" name="billing_phone" id="reg_billing_phone" value="<?php if ( ! empty( $_POST['billing_phone'] ) ) esc_attr_e( $_POST['billing_phone'] ); ?>" />
       </p>
   
       <?php
       }
       add_action( 'woocommerce_register_form_start', 'wooc_extra_register_fields' );
       ```
   
 * Can Anyone Help me solving this problem ?!!

Viewing 1 replies (of 1 total)

 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [10 years ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-when-editing-functionphp/#post-7435620)
 * I recommend asking in this dedicated support sub-forum for better results so 
   its developers and users can help you with this: [http://wordpress.org/support/plugin/woocommerce](http://wordpress.org/support/plugin/woocommerce)

Viewing 1 replies (of 1 total)

The topic ‘Parse error: syntax error, unexpected '{' when editing function.php’ 
is closed to new replies.

## Tags

 * [function.php](https://wordpress.org/support/topic-tag/function-php/)
 * [registration form](https://wordpress.org/support/topic-tag/registration-form/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [t-p](https://wordpress.org/support/users/t-p/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-when-editing-functionphp/#post-7435620)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
