How to get bundle in form alter?
This is the final solution:

use Drupal\Core\Entity\ContentEntityForm;

$bundle = FALSE;
$form_object = $form_state-&gt;getFormObject();
if ($form_object instanceof ContentEntityForm) {
  $bundle = $form_object-&gt;getEntity()-&gt;bundle();
}