Magento 1.7 – Fix Configurable Product Options Not Added to Cart Using SOAP API

apimagento-1.7shopping-cartsoap

I have tried to add a configurable product in using magento soap api. I am using the following code to add

 $product = array(
             'product_id' => 23,    // simple product id
             'sku' => 'H001-Yellow-22',
             'qty' => '1',

            'super_attribute' => Array( [92] => 10, [134] => 3 )  // color is yellow                                                 and
size is 22        

        );
$client->shoppingCartProductAdd($session,$cartId,array($product),'1');

Instead of superattribute, i gave like this also

'super_attribute' => array(
                0 => array(
                'key' => 92,
                'value' => 10
                ),
                1 => array(
                'key' => 134,
                'value' => 3
                )
            )

but the options are not added to the cart. Why the options are not added to the cart? How the options to be added?

Best Answer

finally my config product has added to cart using magento api

$product = array(
            'product_id' => 19,   // config product id
            'sku' => 'H001',
            'qty' => '1',

           'super_attribute' => array(
                0 => array(
                'key' => 92,        //attribute id
                'value' => 10       //value
                ),
                1 => array(
                'key' => 134,
                'value' => 3
                )
            )
        );  

$client->shoppingCartProductAdd($session,$cartId, array($product));
Related Topic