Fix missing state selector(dropdown) for logged-in users.

This commit is contained in:
Mantish 2013-02-06 18:57:57 -05:00
parent d6a9f3e460
commit c1ef529fe8
1 changed files with 5 additions and 2 deletions

View File

@ -1326,10 +1326,13 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
$current_cc = woocommerce_clean( $_POST[ $country_key ] );
} elseif ( is_user_logged_in() ) {
$current_cc = get_user_meta( get_current_user_id() , $country_key, true );
if ( ! $current_cc) {
$current_cc = apply_filters('default_checkout_country', ($woocommerce->customer->get_country()) ? $woocommerce->customer->get_country() : $woocommerce->countries->get_base_country());
}
} elseif ( $country_key == 'billing_country' ) {
$current_cc = apply_filters('default_checkout_country', ($woocommerce->customer->get_country()) ? $woocommerce->customer->get_country() : $woocommerce->countries->get_base_country());
} else {
$current_cc = apply_filters('default_checkout_country', ($woocommerce->customer->get_shipping_country()) ? $woocommerce->customer->get_shipping_country() : $woocommerce->countries->get_base_country());
$current_cc = apply_filters('default_checkout_country', ($woocommerce->customer->get_shipping_country()) ? $woocommerce->customer->get_shipping_country() : $woocommerce->countries->get_base_country());
}
$states = $woocommerce->countries->get_states( $current_cc );
@ -1474,4 +1477,4 @@ if ( ! function_exists( 'get_product_search_form' ) ) {
else
return apply_filters( 'get_product_search_form', $form );
}
}
}