How to Remove Billing Address in WooCommerce
You can remove the address filed from the checkout page in Woocommerce. Use the woocommerce_billing_fields filter
to remove the billing address field in the theme function page(functions.php) .
Remove Billing Fields
You have to add the following code to remove the billing address
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<?php add_filter('woocommerce_billing_fields','wpb_custom_billing_fields'); function wpb_custom_billing_fields( $fields = array() ) { unset($fields['billing']['billing_first_name']); unset($fields['billing']['billing_last_name']); unset($fields['billing']['billing_email']); unset($fields['billing']['billing_phone']); unset($fields['billing']['billing_company']); unset($fields['billing']['billing_address_1']); unset($fields['billing']['billing_address_2']); unset($fields['billing']['billing_city']); unset($fields['billing']['billing_country']); unset($fields['billing']['billing_state']); unset($fields['billing']['billing_city']); unset($fields['order']['order_comments']); unset($fields['order']['order_comments']); return $fields; } |
So this will remove all billing address fields. If you want to keep the certain then just remove that line from the code snippet.
if you want to remove only the email then use the following code :
1 2 3 4 5 6 |
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); function custom_override_checkout_fields( $fields ) { unset($fields['billing']['billing_email']); return $fields; } |