Magento create product programmatically

Magento create product programmatically : It’s very common to create products in magento from admin panel but sometimes we need to create products programatically for some specific requirement. You can create products programatically and assign values dynamically as per your requirement. Here we are going to learn how to create simple product in magento programatically.

Magento create product programmatically

You can create products programmatically as below-

Magento create product programmatically:

public function createProduct(){
    // first set current store
    // load catalog produuct model
    $product = Mage::getModel('catalog/product');
               ->setName("Test Product")
               ->setDescription("Test Description")
               ->setShortDescription("Test Short Description")
}catch(Exception $e){
Mage::log("Exception ---". $e->getMessage());


The above function will create simple product in magento which is decided by type id. You can add categories, price, name sku and quantity etc while creating product


Add Comment

📖 Read More