I know how to add a simple product but cannot create a downloadable product programmatically. I am using following code for adding downloable product information:-
$product->setProductHasWeight(0); // weight of product
$product->setIsDownloadable(1);
$doanloadable_data = array(
'link' =>array('title' => 'first downloable product',
'price' => 9,
'number_of_downloads' => 10,
'is_shareable' => 1,
'type' => 'url',
'link_url' => 'http://w3solver.com',
'sample' => array('url'=>'http://w3solver.com',
'type' => 'url'),
'is_unlimited' => 0,
),
'sample' => array('title' => 'sample',
'sample_url' => 'http://w3solver.com',
'type' => 'url',
)
);
$product->setDownloadable($doanloadable_data);
$product->save();
Anyone here can please help me to find out what is the issue over here or what I can do make it work.