Adding text above some fields checkout form
-
I am trying to get some simple formated text after 4th field of checkout form , when loading it displays in the right position , but when fully loaded text jumps to the top of form. The code to add test i used in form-billing.php
$fields = $checkout->get_checkout_fields( 'billing' ); $i = 0; //twof foreach ( $fields as $key => $field ) { $i ++; if ($i == 5) { echo 'Some text'; } if ( isset( $field['country_field'], $fields[ $field['country_field'] ] ) ) { $field['country'] = $checkout->get_value( $field['country_field'] ); } $field['input_class'][] = 'form-control'; woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); }
i have also tried:
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);
same issue, text jumps to the top of form when fully loaded.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Adding text above some fields checkout form’ is closed to new replies.