Updating programmatically customer's billing information in WooCommerce

You can do it using update_user_meta() function, this way:

$user_id =  get_current_user_id();

$data = array(
    'billing_city'          => $city_value,
    'billing_postcode'      => $postcode_value,
    'billing_email'         => $email_value,
    'billing_phone'         => $phone_value,
);
foreach ($data as $meta_key => $meta_value ) {
    update_user_meta( $user_id, $meta_key, $meta_value );
}

You will need to set the values in the array.


You have to save the changes after setting properties. In your code, after the foreach, add:

$customer->save();

And voila!