Hello Magento Friends,

Tier pricing is a valuable feature in Magento 2 that allows store owners to set different pricing levels based on the quantity purchased, encouraging bulk purchases by offering discounts. However, sometimes, the default tier pricing grid might not meet all the requirements, and adding custom columns to this grid becomes necessary.

This blog will guide you through the process of adding a custom column to the tier price section in Magento 2 Admin.

Steps to Add a Column to Tier Price in Magento 2 Admin:

Step 1: Create a db_schema.xml file using the path given below.

{{magento_root}}\app\code\Vendor\Extension\etc\db_schema.xml

Then add the following code

Step 2: Create a di.xml in the path given below.

{{magento_root}}\app\code\Vendor\Extension\etc\adminhtml\di.xml  

Then add the code as given below

Step 3: Create a di.xml file in the path given below.

{{magento_root}}\app\code\Vendor\Extension\etc\di.xml

Now add the below-given code

Step 4: Create an UpdateTierPricing.php file in the path given below.

{{magento_root}}\app\code\Vendor\Extension\Ui\DataProvider\Product\Form\Modifier\UpdateTierPricing.php

Now include the code snippet as given below

Step 5: Create a SaveHandler.php file in path given below.

{{magento_root}}\app\code\Vendor\Extension\Model\Product\Attribute\Backend\TierPrice\SavePriceHandler.php

Now add the code as follows

Step 6: Create a UpdatePriceHandler.php file in the given below path.

{{magento_root}}\app\code\Vendor\Extension\Model\UpdatePriceHandler.php

Then add the following code

Step 7: Create a DataColumnUpdate.php file in path given below.

{{magento_root}}\app\code\Vendor\Extension\Model\ResourceModel\Product\Attribute\Backend\DataColumnUpdate.php

Now include the following code

Step 8: Create a catalog_product_prices.xml file in path given below.

{{magento_root}}\app\code\Vendor\Extension\view\base\layout\catalog_product_prices.xml

After that, add the below-mentioned code

Step 9: Create a tier_price.phtml file in path given below.

{{magento_root}}\app\code\Vendor\Extension\view\base\templates\product\price\tier_price.phtml

Now add the following code

Output:

The custom column will be added to the admin grid for tier pricing.

custom column admin

Custom column content of tier price is displayed in Magento 2 frontend.

custom column frontend

Conclusion:

By following these steps, you can easily add a custom column to the tier price grid in the Magento 2 Admin.

Related Tutorials – 

Click to rate this post!
[Total: 1 Average: 5]