Merge pull request #2379 from Mantish/patch-1

Fix missing state selector(dropdown) for logged-in users. issue #1776
This commit is contained in:
Mike Jolley 2013-02-08 10:05:34 -08:00
commit bb181ce632
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 );
}
}
}