I am able add tier prices using csv

$this->tierPrice->add($sku, $customerGroupId, $price, $qty);

but it is taking "value_type" as Fixed , i want to dynamically give the value for "value_type"


I done the same by doing

$product_obj = $this->_objectManager->create('Magento\Catalog\Model\Product')->load($prod_id);
    $tierPrices[] = array(
                                 'website_id'  => 0,
                                 'cust_group'  => 1,
                                 'price_qty'   => $qty,
                                 'price'       => $price,
                                 'percentage_value'  => $percentage);
Here in the above array   `percentage_value` is given for the price range having discount type.         

I used Rakesh Jesadiya article information and done some debugging to create more "elegant" solution for percentage_value tier price type. Here is my code:

use Magento\Catalog\Api\Data\ProductTierPriceInterface;
use Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory;
use Magento\Catalog\Api\ScopedProductTierPriceManagementInterface;

class ProductPriceListsResolver
     * @var ScopedProductTierPriceManagementInterface
    private $tierPriceManagement;
     * @var ProductTierPriceInterface
    private $productTierPriceFactory;

    public function __construct(
        ScopedProductTierPriceManagementInterface $tierPriceManagement,
        ProductTierPriceInterfaceFactory $productTierPriceFactory
    ) {

        $this->tierPriceManagement = $tierPriceManagement;
        $this->productTierPriceFactory = $productTierPriceFactory;

    public function resolve()
        $sku = 'sku_83519'; //Product sku
        $customerGroupId = 6; //premium group id
        $price = 50.00;
        $qty = 1.00;

        /** @var ProductTierPriceInterface $productTierPrice */
        $productTierPrice = $this->productTierPriceFactory->create();

        $extensionAttributes = $productTierPrice->getExtensionAttributes();
        try {
            $this->tierPriceManagement->add($sku, $productTierPrice);
        } catch (\Exception $e) {
            throw new $e;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.