• Skip to primary navigation
  • Skip to main content
OsomCode

OsomCode

Awesome code tutorials for WordPress and Genesis

  • Subscribe
  • My account
    • Edit profile
    • Favorites
    • Update credit card
  • Login

How to add a description to a checkout field in WooCommerce

Learn in this tutorial how to add a description to a WooCommerce checkout field with a simple code snippet.

In some cases, adding a description to some fields on the WooCommerce checkout page can help the user better understand what information to enter.

Thanks to the WooCommerce woocommerce_checkout_fields filter you can achieve this easily.

Here’s how to do it:

Snippet to include a description in a WooCommerce checkout field

Add the following code at the end of functions.php or in your functionality plugin:

To see this and another 839 code snippets of this website, login or subscribe here.

In this case you use the woocommerce_checkout_fields filter and add a description to the username and password fields.

Add description to a WooCommerce checkout field
Add description to a WooCommerce checkout field.

If instead of displaying the description below the field you want to display it inside the field, use this snippet instead of the previous one.

To see this and another 839 code snippets of this website, login or subscribe here.

Add placeholder to a WooCommerce checkout field.
Add placeholder to a WooCommerce checkout field.

This is an example designed for when the person who enters the invoice data and the person who will later have access to the content are not necessarily the same, but you can adapt it to your particular needs.

Here you have all the fields of the checkout so you can add the description to the one you want.

  • Billing ([billing])
    • billing_first_name
    • billing_last_name
    • billing_company
    • billing_address_1
    • billing_address_2
    • billing_city
    • billing_postcode
    • billing_country
    • billing_state
    • billing_email
    • billing_phone
  • Shipping ([shipping])
    • shipping_first_name
    • shipping_last_name
    • shipping_company
    • shipping_address_1
    • shipping_address_2
    • shipping_city
    • shipping_postcode
    • shipping_country
    • shipping_state
  • Account ([account])
    • account_username
    • account_password
    • account_password-2
  • Order ([order])
    • order_comments

Conclusion

As you can see, with a few lines of code you can add a description to the field you want on the WooCommerce checkout page.

Any questions? Let me know in the comments.

And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉

PHP Products WooCommerce

To leave read and make questions about this code, you can login or register.

  • About OsomCode
  • FAQ
  • Contact

Legal Notice · Privacy Policy · Cookie Policy · Terms and conditions
Copyright © 2023

Lost your password?