Site logo

Archived topic

Remove address fields in checkout

1 reply · Started by Aaron on March 21, 2023

Viewing posts 1–2 of 2

EDIT, updated code and it is working now:

I see a setting in Customizer to remove the 2nd address field, but we don't need the address at all as all products are virtual. However the standard filter to remove these is not working.:

add_filter('woocommerce_billing_fields','fs_custom_billing_fields');
// remove some fields from billing form

function fs_custom_billing_fields( $fields = array() ) {

unset($fields['billing_company']);
unset($fields['billing_address_1']);
unset($fields['billing_address_2']);
unset($fields['billing_state']);
unset($fields['billing_city']);
unset($fields['billing_phone']);
unset($fields['billing_postcode']);
unset($fields['billing_country']);

return $fields;
}

Hi Aaron,

I see. Glad you resolved the issue!

This archived topic is closed to new replies.