Merge pull request #10341 from JeroenSormani/checkout-fields-value

Use real checkout fields for getting value
This commit is contained in:
Mike Jolley 2016-02-15 13:30:24 +00:00
commit e4e4a854c2
1 changed files with 12 additions and 8 deletions

View File

@ -765,18 +765,22 @@ class WC_Checkout {
} }
// Get the billing_ and shipping_ address fields // Get the billing_ and shipping_ address fields
$address_fields = array_merge( WC()->countries->get_address_fields(), WC()->countries->get_address_fields( '', 'shipping_' ) ); if ( isset( $this->checkout_fields['shipping'] ) && isset( $this->checkout_fields['billing'] ) ) {
if ( is_user_logged_in() && array_key_exists( $input, $address_fields ) ) { $address_fields = array_merge( $this->checkout_fields['billing'], $this->checkout_fields['shipping'] );
$current_user = wp_get_current_user();
if ( $meta = get_user_meta( $current_user->ID, $input, true ) ) { if ( is_user_logged_in() && is_array( $address_fields ) && array_key_exists( $input, $address_fields ) ) {
return $meta; $current_user = wp_get_current_user();
if ( $meta = get_user_meta( $current_user->ID, $input, true ) ) {
return $meta;
}
if ( $input == 'billing_email' ) {
return $current_user->user_email;
}
} }
if ( $input == 'billing_email' ) {
return $current_user->user_email;
}
} }
switch ( $input ) { switch ( $input ) {