cancel
Showing results for 
Search instead for 
Did you mean: 

Add a configurable product to the cart,using the API Soap.

Add a configurable product to the cart,using the API Soap.

I need to add a configurable product to the cart,using the API Soap,but I always get the following error:
"Uncaught SoapFault exception: [1022]: Please specify the product required options"
The part of the code  that is the problem is the following:

 

$product = array(
            'product_id' => $product->getId(),
            'sku' => $product->getSku(),
            'qty' => 1,
          
           'options' => array(
        135 => '14',   //              135 is Id size attribute , 14 is id  my options (size ‘S’) 
    ),
            'bundle_option' => null,
            'bundle_option_qty' => null,
            'links' => null
        );
$productAdded = $proxy->shoppingCartProductAdd($sessionId,$quote->getId(),array($product),'1');

 

I also tried this way :

 

$product = array( 
'product_id' => $product->getId(), 
'sku' => $product->getSku(), 
'qty' => '1', 
'super_attribute' => 
array( 
0 => array( 
'key' => 135, 'value' => 14) 
), 
'bundle_option' => null, 
'bundle_option_qty' => null,
'links' => null );

$productAdded = $proxy->shoppingCartProductAdd($sessionId,$quote->getId(),array($product),'1');

End Also : 

 

$product = array( 
'product_id' => $product->getId(), 
'sku' => $product->getSku(), 
'qty' => '1', 
'super_attribute' => [
                   '135' =>'14' // attributeId => valueId
     ],

'bundle_option' => null, 
'bundle_option_qty' => null,
'links' => null );

$productAdded = $proxy->shoppingCartProductAdd($sessionId,$quote->getId(),array($product),'1');


I tried all solutions that I found online, but I always get the same error.
Could someone kindly explain to me what is the proper way to add an option to a configurable product using the "shoppingCartProductAdd ()" Soap API  v2?,

Thank you,
Have a nice day.

 

 

1 REPLY

Re: Add a configurable product to the cart,using the API Soap.

Hi @alexanderinaldi

 

 

Can you first verify how many custom options are set as "required" into the admin? You need to pass all those option values into the request. Because this error generally occures when there isn't any option value passed.

Found something useful, please give "Kudos" or "Accept as Solution" for Token of Appreciation.
Free Magento Extensions : https://magecomp.com/free-magento-extensions.html