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:
In this case you use the
woocommerce_checkout_fields filter and add a description to the username and password fields.
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.
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 (
- Shipping (
- Account (
- Order (
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. 😉