public function set_address($address, $type = 'billing') { foreach ($address as $key => $value) { update_post_meta($this->get_id(), "_{$type}_" . $key, $value); if (is_callable(array($this, "set_{$type}_{$key}"))) { $this->{"set_{$type}_{$key}"}($value); } } }