Title: Address edit bug
Last modified: April 4, 2019

---

# Address edit bug

 *  Resolved [taisho](https://wordpress.org/support/users/taisho/)
 * (@taisho)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/address-edit-bug/)
 * Hello,
 * this bug happens when I edit address in My account (billing or shipping) using
   submit button with name save_address. I actually didn’t even change anything 
   at first, but my postcode 62-080 got changed to 62080.
 * It was entered properly in checkout, displayed correctly later everywhere including
   textbox before edit, until I edited address. I can type 62-080 in input box, 
   but hyphen will always disappear after submit.
 * Regards
    -  This topic was modified 7 years, 2 months ago by [taisho](https://wordpress.org/support/users/taisho/).

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

 *  [Praveen a11n](https://wordpress.org/support/users/spraveenitpro/)
 * (@spraveenitpro)
 * Automattic Happiness Engineer
 * [7 years, 2 months ago](https://wordpress.org/support/topic/address-edit-bug/#post-11392909)
 * Hi Taisho,
 * I just tested this, and it works based on countries, once I set the base country
   to Poland then I was able to goto my-account page and set a postal code with 
   dashes like this: [https://cld.wthms.co/bOXaif](https://cld.wthms.co/bOXaif)
 * I am having a hunch that it could be a conflict from your theme or one of the
   other plugins installed, Can you test by deactivating all plugins except for 
   WooCommerce and switching to the StoreFront theme to check if the behavior persists?
 * If the issue goes away then activate plugins/theme one by one to check which 
   one is causing the behavior. Also please ensure to update to the latest version
   of WooCommerce.
 * Cheers!
 *  Thread Starter [taisho](https://wordpress.org/support/users/taisho/)
 * (@taisho)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/address-edit-bug/#post-11397290)
 * Thank You Praveen. I narrowed down where the issue lies and it’s functions.php
   of my child Storefront theme. I didn’t follow the usual procedure, because it
   seemed highly unlikely for such error to be caused by any plugin or Storefront,
   but switching to default Storefront alone showed that it’s my modifications, 
   I have 3 rather popular snippets meddling with addresses and removing any single
   one doesn’t help. Hopefully I figure out what’s wrong.
 * Cheers!
    -  This reply was modified 7 years, 2 months ago by [taisho](https://wordpress.org/support/users/taisho/).
 *  Thread Starter [taisho](https://wordpress.org/support/users/taisho/)
 * (@taisho)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/address-edit-bug/#post-11397453)
 * It came out that because of cache my tests didn’t go correctly. It was only 1
   snipped causing problems. You were correct to mention that postcode format change
   is connected to country. I post a working snippet which is fixed by adding ‘country’
   to array, but the thing is that shop is only country-wide and I don’t really 
   want it to be displayed, any ideas for fix? Hiding with CSS is possible for form
   edit, but in Addresses tab of My Account there is also whole address generated
   as plain text after <br> and perhaps in other places too, so CSS is not an option.
 * It’s a shame that in “sell to specific country” I have only Poland selected, 
   Poland is the only country in my shipping zones and still address in My account
   section won’t allow me to store proper Polish addresses (if user goes in edit
   mode and saves changes, no matter if anything is actually changed) if I decide
   not to show country.
 *     ```
       add_filter( 'woocommerce_default_address_fields', 'custom_default_address_fields' );
       function custom_default_address_fields( $fields ) {
           $fields_order = array( 'first_name', 'last_name', 'company', 'address_1', 'postcode', 'city', 'country');
   
           // Set fields priority
           $priority = 10;
   
           foreach ( $fields_order as $key ) {
               if ( ! isset( $fields[ $key ] ) ) {
                   continue;
               }
   
               $fields[ $key ]['priority'] = $priority;
               $priority += 10;
           }
   
           // Change fields order
           $fields_ordered = array();
   
           foreach ( $fields_order as $key ) {
               if ( isset( $fields[ $key ] ) ) {
                   $fields_ordered[ $key ] = $fields[ $key ];
               }
           }
   
           return $fields_ordered;
       }
       ```
   
    -  This reply was modified 7 years, 2 months ago by [taisho](https://wordpress.org/support/users/taisho/).
    -  This reply was modified 7 years, 2 months ago by [taisho](https://wordpress.org/support/users/taisho/).

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

The topic ‘Address edit bug’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [zipcode](https://wordpress.org/support/topic-tag/zipcode/)

 * 3 replies
 * 2 participants
 * Last reply from: [taisho](https://wordpress.org/support/users/taisho/)
 * Last activity: [7 years, 2 months ago](https://wordpress.org/support/topic/address-edit-bug/#post-11397453)
 * Status: resolved