Skip to content

Instantly share code, notes, and snippets.

@BFTrick
Created May 26, 2016 15:09
Show Gist options
  • Save BFTrick/7a7e5ca328e06bdb6e816c1770e4a526 to your computer and use it in GitHub Desktop.
Save BFTrick/7a7e5ca328e06bdb6e816c1770e4a526 to your computer and use it in GitHub Desktop.
Remove the Phone Number field in the WooCommerce checkout
<?php
// Filter the checkout fields
add_filter( 'woocommerce_checkout_fields', 'patricks_woocommerce_checkout_fields' );
// Remove the billing phone - $fields is passed via the filter
function patricks_woocommerce_checkout_fields( $fields ) {
// remove the phone field
unset($fields['billing']['billing_phone']);
// make the billing email field fill up the entire space
$fields['billing']['billing_email']['class'] = array('form-row-wide');
return $fields;
}
@zinacouture
Copy link

how about default script for shipping address country to United States. Thanks for putting up the codes!!!! lifesaver.

@zinacouture
Copy link

  • Manipulate default state and countries

  • As always, code goes in your theme functions.php file

*/

add_filter( 'default_checkout_country', 'change_default_checkout_country' );

add_filter( 'default_checkout_state', 'change_default_checkout_state' );

function change_default_checkout_country() {

return 'US'; // country code

}

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