Display field labels inside checkout fields in WooCommerce

Display field labels inside checkout fields in WooCommerce on child sites.

Snippet Type

Execute on Child Sites

Snippet

add_filter( 'woocommerce_checkout_fields', 'wc_labels_inside_checkout_fields', 9999 );
   
function wc_labels_inside_checkout_fields( $fields ) {
   foreach ( $fields as $section => $section_fields ) {
      foreach ( $section_fields as $section_field => $section_field_settings ) {
         $fields[$section][$section_field]['placeholder'] = $fields[$section][$section_field]['label'];
         $fields[$section][$section_field]['label'] = '';
      }
   }
   return $fields;
}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.