HummingbirdUK main logo

Coding solutions to business problems

About us

We use code to create solutions to business challenges, bottle-necks and headaches.

If you think your business has a problem that can be solved through code, we are happy to chat things through without any obligation.

Get in touch

Change Magento descriptions programmatically

Home / Blog / Change Magento descriptions programmatically

Written by Giles Bennett

This is a simple script to bulk update Magento products' descriptions quickly and easily. It takes as its input a two column CSV, which simply has the product SKU in the first column, and the new description in the second column - this CSV is uploaded to the web root of your site, along with the script file.

Script To Bulk Update Magento Products' Descriptions

require_once 'app/Mage.php';

Change the name of the CSV file in the next line to match your own CSV :

$file_handle = fopen("descriptions.csv", "r");

The script then loops through the file line by line, gets the SKU from the first column and the new description from the second. It then tries to load the product - if it's successful in doing so then it sets the new description as the product's description, then saves the products and reports success.

while (!feof($file_handle) ) {
	$line_of_text = fgetcsv($file_handle, 1024);
	$productSku = $line_of_text[0];
	$newDescription = $line_of_text[1];
	$simpleProduct = Mage::getModel('catalog/product')->loadByAttribute('sku',$productSku);
	if($simpleProduct) {
		echo "Updated product " . $productSku . "<br>";

Run the file through your browser or - better still - over SSH. The latter is advised if you've got a large number of descriptions to amend, as it's likely that your browser would time out.

Author : Giles Bennett

About the author

Giles Bennett built his first website in 1996, and is old enough to miss Netscape Navigator. Initially a lawyer, he jumped ship to IT in 2008, and after 5 years as a freelancer, he founded HummingbirdUK in 2013. He can be reached by email at