code: public function createButton(GetOperationButtonEvent $event)
      {
          if ('createvariant' !== $event->getCommand()->getName()) {
              return;
          }
          /** @var Model $model */
          $model     = $event->getModel();
          $metamodel = $model->getItem()->getMetaModel();
  
          if (!$metamodel->hasVariants() || $model->getProperty('varbase') === '0') {
              $event->setHtml('');
          }
      }
docs: Check if we have to add the "Create variant" button.
  
  @param GetOperationButtonEvent $event The event.
  
  @return void