If the user has not entered an address yet, then the address fields will be displayed in a default order, because the $country will be empty. To fix this and initialize address formats to the stores locale, the $country variable is set to the base_country if it has no value