Import tier prices magento

This tutorial I am explaining how to import tier prices magento. Tier pricing gives a quantity discount from the catalog list and product detail pages. The discount can be applied to a specific store view or customer group .

In this example I reading the tier prices from the discounts file which I exported from the opencart.

Step by step explanation

  1. Read data from the discounts.csv file
  2. Import tier prices magento

Read data from discount.csv

The following code reads the data from the discounts.csv file and save that data in an array as shown below.

Import tier prices magento

Import tier prices

The result array contains the tier price details and the productId as the array index. While saving the simple and the configurable products its loop through the discount array and saves the discounts corresponding to the products.

  foreach( $discount_arr[$import_product[0]] as $key => $value ){
                 $tierPrices[] = array(
                 'website_id'        => 0 ,
                'cust_group'    => '32000',
                'price_qty' => $key,
                'price'   => $value

             );
            }
            $product->setTierPrice($tierPrices);

import-tier-price-admin
import-tier-price-frontend

Share this Tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *

*