Ensure date exists before setting

Fixes #13269
This commit is contained in:
Mike Jolley 2017-02-21 20:50:52 +00:00
parent 04955093d6
commit af39a16434
1 changed files with 8 additions and 2 deletions

View File

@ -834,8 +834,14 @@ class WC_Checkout {
// Add customer info from other fields.
if ( $customer_id && apply_filters( 'woocommerce_checkout_update_customer_data', true, $this ) ) {
$customer = new WC_Customer( $customer_id );
$customer->set_first_name( $data['billing_first_name'] );
$customer->set_last_name( $data['billing_last_name'] );
if ( ! empty( $data['billing_first_name'] ) ) {
$customer->set_first_name( $data['billing_first_name'] );
}
if ( ! empty( $data['billing_last_name'] ) ) {
$customer->set_last_name( $data['billing_last_name'] );
}
foreach ( $data as $key => $value ) {
// Use setters where available.