Hello,
Please add the below code to the functions.php file into the Child theme.
add_filter( 'woocommerce_form_field', 'pk_checkout_fields_in_label_error', 10, 4 );
function pk_checkout_fields_in_label_error( $field, $key, $args, $value ) {
if ( strpos( $field, '</label>' ) !== 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, '</label>' ), 0);
}
return $field;
}
Then, add the following Custom CSS code to Theme Settings > Custom CSS > Global Custom CSS:
.woocommerce-checkout p.woocommerce-invalid-required-field span.error {
color: #e2401c;
display: block !important;
font-weight: bold;
}
Best Regards.