Skip to content

Instantly share code, notes, and snippets.

@metinsaylan
Last active July 9, 2017 16:40
Show Gist options
  • Save metinsaylan/344384f5eb2f4881734e to your computer and use it in GitHub Desktop.
Save metinsaylan/344384f5eb2f4881734e to your computer and use it in GitHub Desktop.
Removing billing fields from woocommerce checkout page - http://shailan.com/4966/removing-billing-fields-from-woocommerce-checkout-page/
<?php
// woo-remove-billing.php | metinsaylan | 2015-03-15
// This filter removes billing fields from woocommerce checkout page.
// Usage:
// You can include this file in your functions.php file,
// or you can copy and paste this filter to your functions.php file.
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['order']['order_comments']);
unset($fields['shipping']);
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']);
// Setting placeholder texts for Email, Name and Last Name
$fields['billing']['billing_email']['placeholder'] = "E-mail address";
$fields['billing']['billing_first_name']['required'] = false;
$fields['billing']['billing_first_name']['placeholder'] = "First name";
$fields['billing']['billing_last_name']['required'] = false;
$fields['billing']['billing_last_name']['placeholder'] = "Last name";
// Setting form field classes
$fields['billing']['billing_email']['class'] = array('form-row-wide');
$fields['billing']['billing_first_name']['class'] = array('form-row-wide');
$fields['billing']['billing_last_name']['class'] = array('form-row-wide');
return $fields;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment