Question
Is it possible to completely hide the department field called Choose a department on the pre-chat form?
Answer
There is no native setting that will remove the department field entirely. In your pre-chat form settings, unchecking Require Department doesn't remove the field from the pre-chat form but it will make it optional.
However, you can hide the department field from visitors by using the Departments API end-point with an empty array.
<script type="text/javascript"> window.zESettings = { webWidget: { chat: { departments: { enabled: [] } } } }; </script>
Simply add the above code after your widget script on your website. It will look something like this:
<script id="ze-snippet" src=[your widget key here]> </script>
<script type="text/javascript">
window.zESettings = {
webWidget: {
chat: {
departments: {
enabled: []
}
}
}
};
</script>
This code prevents any visitors from seeing the department dropdown and therefore from selecting a department. It does not remove the department functionality from the chat entirely. You can still assign a department to a chat request on the back end using a trigger or the departments.select function.
For more information, see this article: Automatically route chats to departments.