Unlike the other Magento 2 product types, virtual products don't have a physical representation. These can be gift cards, services, certificates, warranties, etc.

Using the admin panel to create a virtual product is not the only way. You might as well be looking for some alternatives. In this case, you can try to create a virtual product programmatically and in this article, you'll learn how to do that.
To create a virtual product in Magento 2 programmatically:

ini_set('display_errors', 1);
use Magento\Framework\App\Bootstrap;
require __DIR__ . '/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get(\Magento\Framework\App\State::class);
try {
$product = $objectManager->create(\Magento\Catalog\Api\Data\ProductInterface::class);
->setSku('Main Virtual') // Set your sku here
->setName('Virtual Color Product') // Name of Product
->setAttributeSetId(4) // Attribute set id
->setStatus(1) // Status on product enabled/ disabled 1/0
->setWeight(10) // weight of product
->setVisibility(4) // visibilty of product (catalog / search / catalog, search / Not visible individually)
->setTaxClassId(0) // Tax class id
->setTypeId('virtual') // type of product (simple/virtual/downloadable/configurable)
->setPrice(500) // price of product
'use_config_manage_stock' => 0,
'manage_stock' => 1,
'is_in_stock' => 1,
'qty' => 200

// Adding Image to product
$imagePath = ""; //Set the path of Image for product
$product->addImageToMediaGallery($imagePath, ['image', 'small_image', 'thumbnail'], false, false);

// Adding Custom option to product
$options = array(
"sort_order" => 1,
"title" => "Custom Option 1",
"price_type" => "fixed",
"price" => "10",
"type" => "field",
"is_require" => 0
"sort_order" => 2,
"title" => "Custom Option 2",
"price_type" => "fixed",
"price" => "20",
"type" => "field",
"is_require" => 0

foreach ($options as $arrayOption) {


$option = $objectManager->create(\Magento\Catalog\Model\Product\Option::class)
echo 'success';
} catch (\Exception $e) {
echo $e->getMessage();

Hopefully, this simple method of creating virtual products in Magento programmatically will prove to be useful.

However, if you want to have a diverse catalogue with an extensive product set, you should also learn how to create downloadable products programmatically, as they are closely related to virtual products.