I'm trying to remove the phone number and email from the WooCommerce My Account edit address from but it's not working. I just want to show the address without the email and the phone number in the form. How can I do this?
What I tried:
<div class="woocommerce-address-fields__field-wrapper">
<?php
unset( $address[$fields['billing_phone']] );
foreach ( $address as $key => $field ) {
if ( isset( $field['country_field'], $address[ $field['country_field'] ] ) ) {
$field['country'] = wc_get_post_data_by_key( $field['country_field'], $address[ $field['country_field'] ]['value'] );
}
woocommerce_form_field( $key, $field, wc_get_post_data_by_key( $key, $field['value'] ) );
}
?>
</div>
This comes right out of the form-edit-address.php
file. I've put it to my child theme because I've did some other changes. So it would be the best solution to remove the field in this PHP file.
Because of the email: I think that I must do something to prevent an error when I submit the form because this field is required there. But no clue how to do this.