How to update group price via SOAP api

How to update group price via SOAP api

September 15, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to update group price via SOAP api

Updating Magento Group Prices via SOAP API

Introduction

If you’re looking to update group prices in your Magento store using the SOAP API, you’ve come to the right place. In this guide, we’ll walk through the process step-by-step and address some common issues that may arise along the way.

Understanding the Problem

The provided code attempts to update a product’s tier price via the product_attribute_group_price.update method of the SOAP API. However, it results in an error: Uncaught SoapFault exception: [3] Invalid api path.

This error occurs because there is no such method as product_attribute_group_price.update in Magento’s SOAP API. The SOAP API does not provide a direct way to update group prices at the product level.

The Correct Approach

To achieve this, you need to use a combination of methods to first retrieve the existing tier prices and then update them with the new values.

Here’s a corrected version of the code that demonstrates how to accomplish this:

require_once 'app/Mage.php';
$proxy = new SoapClient('http://example.com/api/soap/?wsdl');
$sessionId = $proxy->login('abhi', '123456');

$productId = 1;
$price = 200;

// Retrieve the existing tier prices
$result = $proxy->call(
    $sessionId,
    'product_attribute_tier_price.list',
    array(
        $productId
    )
);

if (empty($result)) {
    echo "No tier prices found for this product.";
    return;
}

// Update the group price
$groupId = 2; // Your customer group ID here
foreach ($result as $tierPrice) {
    if ($tierPrice['customer_group_id'] == $groupId) {
        $newTierPrices = array(
            array('customer_group_id' => $groupId, 'website' => '0', 'qty' => 1, 'price' => $price)
        );

        $updateResult = $proxy->call(
            $sessionId,
            'product_attribute_tier_price.update',
            array(
                $tierPrice['entity_id'],
                $newTierPrices
            )
        );

        if ($updateResult) {
            echo "Group price updated successfully for customer group ID: $groupId";
        } else {
            echo "Error updating group price.";
        }
    }
}

Explanation

This script performs the following steps:

  1. Logs into Magento’s SOAP API using valid credentials.
  2. Retrieves all existing tier prices for the specified product via the product_attribute_tier_price.list method.
  3. Loops through these tier prices looking for a match with the desired customer group ID.
  4. If a match is found, it prepares an array of new tier prices with the updated value and calls the product_attribute_tier_price.update method to apply the changes.

Note that you’ll need to replace 'http://example.com/api/soap/?wsdl' with your actual Magento store’s SOAP API URL, and 'abhi' and '123456' with your valid admin username and password. Also, make sure to set $groupId to the correct customer group ID you want to update.

Conclusion

In this post, we’ve addressed a common issue related to updating Magento’s group prices via the SOAP API and provided a solution that works around the limitations of the available methods.

Remember that while the SOAP API provides a wide range of functionalities, it may not always offer direct solutions for every requirement. In such cases, creative problem-solving and a deep understanding of the system are key to finding effective workarounds.

To learn more about Magento’s API capabilities and best practices for integrating with your store, I recommend exploring our comprehensive Magento API guides at Laravel Company.

Catalog API Customers Pricing

Our network