Skip to content

Instantly share code, notes, and snippets.

@paaljoachim
Last active January 10, 2018 08:16
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 paaljoachim/7da8d62b3f46485c33c6620ffeabb091 to your computer and use it in GitHub Desktop.
Save paaljoachim/7da8d62b3f46485c33c6620ffeabb091 to your computer and use it in GitHub Desktop.
WooCommerce checkout field adjustments. Removes company, country, address, city, state and postcode. I have commented out the removing of phone and e-mail. I have also removed the additional information box.
/* -------- WooCommerce - checkout fields ---------- */
/* From Kathy. */
function kia_modify_default_address_fields( $fields ){
if( isset( $fields['company'] ) ) unset( $fields['company'] );
if( isset( $fields['country'] ) ) unset( $fields['country'] );
if( isset( $fields['address_1'] ) ) unset( $fields['address_1'] );
if( isset( $fields['address_2'] ) ) unset( $fields['address_2'] );
if( isset( $fields['city'] ) ) unset( $fields['city'] );
if( isset( $fields['state'] ) ) unset( $fields['state'] );
if( isset( $fields['postcode'] ) ) unset( $fields['postcode'] );
return $fields;
}
add_filter( 'woocommerce_default_address_fields', 'kia_modify_default_address_fields' );
function kia_remove_billing_phone_fields( $fields ){
// if( isset( $fields['billing_phone'] ) ) unset( $fields['billing_phone'] );
// if( isset( $fields['billing_email'] ) ) $fields['billing_email']['class'] = array( 'form-row-wide' );
return $fields;
}
add_filter( 'woocommerce_billing_fields', 'kia_remove_billing_phone_fields' );
// https://businessbloomer.com/woocommerce-remove-order-notes-checkout-page/
// Removes the Additional Information box.
add_filter( 'woocommerce_enable_order_notes_field', '__return_false' );
@paaljoachim
Copy link
Author

Add the above into the child theme functions.php or an external woocommerce code snippet file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment