skip to Main Content

I’m trying to hide the label text above the fields on Woocommerce Checkout but I can’t figure out how to do it. I’ve tried many things found online but they are too dated.

2

Answers


  1. This should do what you’re looking for.

    add_filter( 'woocommerce_checkout_fields', 'remove_checkout_labels' , 10, 1);
    
    function remove_checkout_labels($fields){
        $new_fields = array();
        foreach($fields as $key => $value){
            unset($value['label']);
            $new_fields[$key] = $value;
        }
        return $new_fields;
    }
    
    Login or Signup to reply.
  2. This is answered by gmo in this similar thread:
    Woocommerce: remove all form labels at once

    // WooCommerce Checkout Fields Hook
    add_filter('woocommerce_checkout_fields','custom_wc_checkout_fields_no_label');
    
    // Our hooked in function - $fields is passed via the filter!
    // Action: remove label from $fields
    function custom_wc_checkout_fields_no_label($fields) {
        // loop by category
        foreach ($fields as $category => $value) {
            // loop by fields
            foreach ($fields[$category] as $field => $property) {
                // remove label property
                unset($fields[$category][$field]['label']);
            }
        }
         return $fields;
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search