Last active
March 11, 2021 15:39
-
-
Save scottopolis/417933a86a1253ff1def243bccd3e430 to your computer and use it in GitHub Desktop.
Remove WooCommerce Company, Order Notes, Phone, and Address 2 Fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// put this code in your theme functions.php or a custom plugin | |
add_filter( 'woocommerce_checkout_fields' , 'sb_remove_woo_checkout_fields' ); | |
function sb_remove_woo_checkout_fields( $fields ) { | |
// remove some billing fields | |
unset($fields['billing']['billing_company']); | |
unset($fields['billing']['billing_address_2']); | |
unset($fields['billing']['billing_phone']); | |
// other fields you can remove | |
// unset($fields['billing']['billing_address_1']); | |
// unset($fields['billing']['billing_city']); | |
// unset($fields['billing']['billing_postcode']); | |
// unset($fields['billing']['billing_country']); | |
// unset($fields['billing']['billing_state']); | |
// unset($fields['billing']['billing_email']); | |
// remove some shipping fields | |
unset($fields['shipping']['shipping_company']); | |
// other shipping fields you can remove | |
// unset($fields['shipping']['shipping_first_name']); | |
// unset($fields['shipping']['shipping_last_name']); | |
// unset($fields['shipping']['shipping_address_1']); | |
// unset($fields['shipping']['shipping_address_2']); | |
// unset($fields['shipping']['shipping_city']); | |
// unset($fields['shipping']['shipping_postcode']); | |
// unset($fields['shipping']['shipping_country']); | |
// unset($fields['shipping']['shipping_state']); | |
// remove order comment fields | |
unset($fields['order']['order_comments']); | |
return $fields; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment