Merge pull request #14014 from woocommerce/fix/13906

Set session data only if the value is empty in customer object. Prevents session data overwriting customer data on login.
This commit is contained in:
Claudio Sanches 2017-04-06 10:12:54 -03:00 committed by GitHub
commit f2b90d6163
1 changed files with 4 additions and 1 deletions

View File

@ -95,7 +95,10 @@ class WC_Customer_Data_Store_Session extends WC_Data_Store_WP implements WC_Cust
$session_key = str_replace( 'billing_', '', $session_key );
}
if ( ! empty( $data[ $session_key ] ) && is_callable( array( $customer, "set_{$function_key}" ) ) ) {
$customer->{"set_{$function_key}"}( $data[ $session_key ] );
// Only set from session if data is already missing.
if ( ! $customer->{"get_{$function_key}"}() ) {
$customer->{"set_{$function_key}"}( $data[ $session_key ] );
}
}
}
}