skip to Main Content

How do I remove fields on the Woocommerce Checkout page?

I read on this page that it can be done with a filter – tried it but it didn’t work (I changed order_comments by billing_phone which is one of the fields I’d like to hide.

// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );

// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
     unset($fields['order']['order_comments']);

     return $fields;
}

How can I hide the telephone field, for example? Thanks

2

Answers


  1. // Hook in
    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
    
    // Our hooked in function - $fields is passed via the filter!
    function custom_override_checkout_fields( $fields ) {
         unset($fields['billing']['billing_phone']);
    
         return $fields;
    }
    

    That maybe?

    Login or Signup to reply.
  2. You can hide the phone field with this filter:

    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
    function custom_override_checkout_fields( $fields ) {
         unset($fields['billing']['billing_phone']);
    
         return $fields;
    }
    

    Be sure to add this in the file function.php of your current theme.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search