order billing fields do not overwrite value, if provided

(overwriting introduced by 1fa36b5f15)
This commit is contained in:
Matej Kravjar 2018-06-07 08:58:04 +02:00
parent 2bb466d53f
commit 233ac4b313
1 changed files with 9 additions and 5 deletions

View File

@ -332,7 +332,9 @@ class WC_Meta_Box_Order_Data {
$field_name = 'billing_' . $key;
if ( is_callable( array( $order, 'get_' . $field_name ) ) ) {
if ( isset( $field['value'] ) ) {
$field_value = $field['value'];
} elseif ( is_callable( array( $order, 'get_' . $field_name ) ) ) {
$field_value = $order->{"get_$field_name"}( 'edit' );
} else {
$field_value = $order->get_meta( '_' . $field_name );
@ -365,10 +367,12 @@ class WC_Meta_Box_Order_Data {
$field_name = 'billing_' . $key;
if ( is_callable( array( $order, 'get_' . $field_name ) ) ) {
$field['value'] = $order->{"get_$field_name"}( 'edit' );
} else {
$field['value'] = $order->get_meta( '_' . $field_name );
if ( ! isset( $field['value'] ) ) {
if ( is_callable( array( $order, 'get_' . $field_name ) ) ) {
$field['value'] = $order->{"get_$field_name"}( 'edit' );
} else {
$field['value'] = $order->get_meta( '_' . $field_name );
}
}
switch ( $field['type'] ) {