Reputation: 3179
I need some help from Woocommerce ninjas out there.
Is there any way to put some text under fields on woocommerce checkout page?
I know some filter hook I might use but no options like footnote
...
// Hook in
add_filter( 'woocommerce_billing_fields' , 'custom_override_checkout_fields' );
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
// something like footnote???
$fields['billing_first_name']['footnote'] = 'little footnote text right here!!';
return $fields;
}
Any idea??
Upvotes: 0
Views: 4616
Reputation: 63
If you only want plain text maybe you could use CSS :after and target the paragraph field id? for example:
#billing_first_name_field:after {
content: "your footnote text";
font-size: 14px;
color: red;
}
Upvotes: 1
Reputation: 1330
Try 'description' instead of 'footnote':
$fields['billing_first_name']['description'] = 'footnote text';
Note that this text will be escaped using esc_html
, so using HTML tags can be tricky.
As an alternative, you might want to try overriding the woocommerce_form_field_
filter (e.g. woocommerce_form_field_text
, see includes/wc-template-functions.php
from the WooCommerce plugin). Sample:
add_filter('woocommerce_form_field_text', function ($field, $key, $args, $value) {
if ($key === 'billing_first_name') {
$field .= 'footnote text <a href="/">with link</a>';
}
return $field;
}, 10, 4);
Upvotes: 4