I am trying to create product programmatically with code. Product is successfully created but without quantity. How can add quantity.
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // instance of object manager
$product = $objectManager->create('\Magento\Catalog\Model\Product');
$product->setSku('conf5'); // Set your sku here
$product->setName('conf5'); // Name of Product
$product->setAttributeSetId(9); // Attribute set id
$product->setStatus(1); // Status on product enabled/ disabled 1/0
$product->setWeight(10); // weight of product
$product->setWebsiteIds(array(1));
$product->setVisibility(4); // visibilty of product (catalog / search / catalog, search / Not visible individually)
$product->setTaxClassId(3); // Tax class id
$product->setTypeId('configurable'); // type of product (simple/virtual/downloadable/configurable)
$product->setDescription('descript');
$product->setShortDescription('shortdes');
$product->setPrice(100);*/ // price of product
$product->setStockData(
array(
'use_config_manage_stock' => 0,
'manage_stock' => 1,
'is_in_stock' => 1,
'qty' => 9
)
);