Viewing 3 replies - 1 through 3 (of 3 total)
  • Update your PHP code:

    add_filter( 'woocommerce_form_field', 'checkout_fields_in_label_error', 10, 4 );
    
    function checkout_fields_in_label_error( $field, $key, $args, $value ) {
       if ( strpos( $field, '</span>' ) !== false && $args['required'] ) {
          $error = '<span class="error" style="display:none">';
          $error .= sprintf( __( '%s is a required field.', 'woocommerce' ), $args['label'] );
          $error .= '</span>';
          $field = substr_replace( $field, $error, strpos( $field, '</span>' ), 0);
       }
       return $field;
    }
    Thread Starter dexter303

    (@dexter303)

    Awesome! It works. Thank you ??

    Best regards,
    Dexter

    This code has no effect on my site. Woocommerce up to date. Tokoo theme not using it’s own template. Garyfong.com

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘inline error in checkout fields’ is closed to new replies.