Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save brandonkramer/08b5f3563a331173dea52274a071176b to your computer and use it in GitHub Desktop.
Save brandonkramer/08b5f3563a331173dea52274a071176b to your computer and use it in GitHub Desktop.
Add description, (footnote) text or html under a checkout field in WooCommerce
// Text field
add_filter('woocommerce_form_field_text', function ($field, $key, $args, $value) {
if ($key === 'billing_first_name') {
$field .= 'here text <a href="/">with link</a>';
}
return $field;
}, 10, 4);
// Phone field
add_filter('woocommerce_form_field_tel', function ($field, $key, $args, $value) {
if ($key === 'billing_phone') {
$field .= 'here text <a href="/">with link</a>';
}
return $field;
}, 10, 4);
// E-mail field
add_filter('woocommerce_form_field_email', function ($field, $key, $args, $value) {
if ($key === 'billing_email') {
$field .= 'here text <a href="/">with link</a>';
}
return $field;
}, 10, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment