---
title: "How to Set Tier Price Programmatically in Magento"
url: "https://magecomp.com/blog/set-tier-price-programmatically-in-magento/"
date: "2018-01-12T10:44:32+00:00"
modified: "2018-01-12T10:44:32+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
word_count: 307
reading_time: "2 min read"
summary: "By default, Magento comes with many core functionalities & features that makes it perfect CMS for easy management of products as well as an enhanced e-commerce solution. Magento comes with a promot..."
description: "Default Magento comes with functionalities of setting up tier price, but setting up tier price for each and every product takes a time but today MageComp has..."
keywords: "How To"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How to Display Child Products Thumbnail on Magento 2 Group Product Page"
    url: "https://magecomp.com/blog/display-child-products-thumbnail-magento-2-group-product-page/"
  - title: "How to Apply Custom CSS for Specific CMS Page using a CSS file in Magento 2?"
    url: "https://magecomp.com/blog/apply-custom-css-for-specific-cms-page-magento-2/"
  - title: "How to Create Dynamic File while installing Extensions in Magento 2?"
    url: "https://magecomp.com/blog/create-dynamic-file-installing-extensions-magento-2/"
---

# How to Set Tier Price Programmatically in Magento

_Published: January 12, 2018_  
_Author: Dhiren Vasoya_  

![img How to Programetically Set Product Tier Price in Magento](https://magecomp.com/blog/wp-content/uploads/2018/01/img_How-to-Programetically-Set-Product-Tier-Price-in-Magento-1024x332.webp)

By default, Magento comes with many core functionalities & features that makes it perfect CMS for easy management of products as well as an enhanced e-commerce solution. Magento comes with a promotional tier price solution which is very helpful when you want to give discounts based on the quantity of the products that encourages customers to purchase more quantity. Magento displays tier price on both catalog pages as well as the product page just by adding quantity and price from the admin backend.

Recently, while working on one of the Magento stores, I came up with a situation to change tier price of all the store products. After a sip of coffee, I started coding and ended up with a small piece of code that will save my time as well as helped me to update tier price for products. So, today I would like to share the easiest way to ***set tier price programmatically in Magento***.

All you need to do is pass the product ID and tier price to below code and it will work like a charm to set tier price programmatically for the product.

```

try
{
    Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

	$Mytierprices[] = array(
                     'website_id'  => 0,
                     'cust_group'  => 1,
                     'price_qty'   => 5,
  	         'price'   	=> 32
	);
	$product_id = 2;	//PASS YOUR PRODUCT ID HERE
	$product = Mage::getModel('catalog/product')->load($product_id);
            $product->setTierPrice($Mytierprices);
            $product->save();
} catch (Exception $e) {
	echo $e->getMessage();
}
```

You can try and use this code according to your need of setting up tier price for one product or more than one products simply by customizing this code. You can feel free to ask any question regarding this code. Don’t forget to hit down stars and you can also get in touch with us on our social media for more blogs as well as extension updates.
Until that Happy Coding!


---

_View the original post at: [https://magecomp.com/blog/set-tier-price-programmatically-in-magento/](https://magecomp.com/blog/set-tier-price-programmatically-in-magento/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-10-02 10:19:04 UTC_  
