Skip to content

Instantly share code, notes, and snippets.

@sandeshjangam
Last active August 29, 2018 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandeshjangam/098325699f92c598d642e7e592f221b9 to your computer and use it in GitHub Desktop.
Save sandeshjangam/098325699f92c598d642e7e592f221b9 to your computer and use it in GitHub Desktop.
Remove WooCommerce checkout page fields - sandeshjangam.com
<?php
/* This Code Will Removes "company", "address1" & "address2" Checkout Fields */
add_filter( 'woocommerce_checkout_fields' , 'custom_remove_checkout_fields' );
function custom_remove_checkout_fields( $fields ) {
/* Billing Field */
unset( $fields['billing']['billing_company'] );
unset( $fields['billing']['billing_address_1'] );
unset( $fields['billing']['billing_address_2'] );
return $fields;
}
<?php
/* This Code Will Removes All Billing & Additional Checkout Fields */
add_filter( 'woocommerce_checkout_fields' , 'custom_remove_checkout_fields' );
function custom_remove_checkout_fields( $fields ) {
/* Billing Field */
unset( $fields['billing']['billing_first_name'] );
unset( $fields['billing']['billing_last_name'] );
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_postcode'] );
unset( $fields['billing']['billing_country'] );
unset( $fields['billing']['billing_state'] );
unset( $fields['billing']['billing_phone'] );
unset( $fields['billing']['billing_email'] );
/* Additional Filed */
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