I'm trying to update a single 'additional_attribute' for a product. The documentation on this is sparse and I've tried to piece it together via info from the web and browsing the code in Magento, but I can't seem to get it right. Here's the code I have right now:

$update_data = array (
    'additional_attributes' => array (
        'single_data' => array (
            'warehouse' => '6'
$update = $proxy->catalogProductUpdate($sessionId, 'MySKU', $update_data);

All the configurations of the $update_data array that I've tried throw an error:

Fatal error:  Uncaught SoapFault exception: [SOAP-ENV:Server] Cannot access empty property in /var/www/localhost/docs/magentoapi/update_test.php:38

Line 38 is:

$update = $proxy->catalogProductUpdate($sessionId, 'MySKU', $update_data);

Running Magento EE Any help would be greatly appreciated.

1 Answer 1


Was finally able to figure this out. Working code:

$proxy = new SoapClient("https://www.mysite.com/api/v2_soap/?wsdl");
$sessionId = $proxy->login("apiuser", "apipass");

// $prodinfo->set will give you the attribute set of the product
// for *MY* product, this results to '13' which is used in the next step
$prodinfo = $proxy->catalogProductInfo($sessionId, 'MYSKU');

// $attribinfo[xxx]->code will give you the name of the attribute
// $attribinfo[xxx]->attribute_id will be the id of said attribute
// 'xxx' being an array key
// for *MY* product, the attribute I want to update is 'warehouse'
$attribinfo = $proxy->catalogProductAttributeList($sessionId, '13');

// $attribvalues[xxx]->label is the name of the attribute value
// $attribvalues[xxx]->value is the id of the attribute value
// you will use the *ID* to update your product
// for *MY* product, this id is '5'
$attribvalues = $proxy->catalogProductAttributeOptions($sessionId, 'warehouse');

// multiple additional attributes can be added as new elements to the
// 'single_data' array
$update_data = array (
    'additional_attributes' => array (
        'single_data' => array (
            array ('key' => 'warehouse', 'value' => '5')

// and the update call
$update = $proxy->catalogProductUpdate($sessionId, 'MYSKU', $update_data);

Hope this helps someone else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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