WooCommerce: Move Labels Inside Checkout Fields

Although UX and accessibility experts won’t like this customization, it’s still important to know “what’s possible” with WooCommerce.

In regard to the checkout form (billing + shipping + notes), there is a useful “woocommerce_checkout_fields” hook (filter) that is widely used by developers like me to alter the behavior of input fields.

In today’s episode we will take a look, indeed, at how to remove the checkout field labels from their default position (above fields), and use them as placeholders instead, so that we save up some vertical space.


Once the snippet below is active, your WooCommerce checkout fields will look like this; field labels will now display inside their respective input fields.

PHP Snippet: Display Field Labels Inside Input Boxes @ Checkout Page

 * @snippet       Move Labels Inside Inputs - WooCommerce Checkout
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 5
 * @donate $9     https://businessbloomer.com/bloomer-armada/

add_filter( 'woocommerce_checkout_fields', 'bbloomer_labels_inside_checkout_fields', 9999 );
function bbloomer_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;

Where to add custom code?

You should place PHP snippets at the bottom of your child theme functions.php file and CSS at the bottom of its style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my guide "Should I Add Custom Code Via WP Editor, FTP or Code Snippets?" and my video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything went as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting.

If you think this code saved you time & money, feel free to join 17,000+ WooCommerce Weekly subscribers for blog post updates and 250+ Business Bloomer supporters for 365 days of WooCommerce benefits. Thank you in advance!

Need Help with WooCommerce?

Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

10 thoughts on “WooCommerce: Move Labels Inside Checkout Fields

  1. Hello,

    Could you show us how to edit the code so that we can assign this to specific fields, rather than all fields?

    1. Hi Gregory, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  2. Awesome stuff! Now, if we can only get the asterisk to remain for required fields. ; )

  3. Hello,

    Possible to notify user if a field is required of not? As it looks like now it not very good UX. User do not know what fields are required and what are optional

    1. WooCommerce should already change the border to red for required fields, can you see that? Let me know

      1. I actually had the same question coming here. The missing fields are marked red if the user tries to checkout but he has no way of knowing in advance, which fields are considered required.
        I am guessing Ryan Logan had the same question/issue above.

        It seems to be a question of either having everything inline but no required field indicator or keeping everything as is to keep he asterisks. Is there any way out of this dilemma?

        1. Hey Michael, I take the placeholder could take an “*” if the field is required, or you could style field borders via CSS. I’m afraid this is custom work – if you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

          1. Hello all,
            For me, the following solution worked well. It adds an asterix for required fields and (optional) for not-required fields. You can change it to whatever you need in the code. Hope it works for you too.

            add_filter( 'woocommerce_checkout_fields', 'bbloomer_labels_inside_checkout_fields', 9999 );
            function bbloomer_labels_inside_checkout_fields( $fields ) {
            	foreach ( $fields as $section => $section_fields ) {
            		foreach ( $section_fields as $section_field => $section_field_settings ) {
            			if ($fields[$section][$section_field]['required'] == true) {
            				$fields[$section][$section_field]['placeholder'] = $fields[$section][$section_field]['label'] .= '*';
            			} else {
            				$fields[$section][$section_field]['placeholder'] = $fields[$section][$section_field]['label'] .= ' (optional)';
            		$fields[$section][$section_field]['label'] = '';
            	return $fields;
Questions? Feedback? Support? Leave your Comment Now!

If you are writing code, please wrap it between shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)

Your email address will not be published. Required fields are marked *